<!DOCTYPE html>
<html lang="en-US" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>前言 | VitePress</title>
    <meta name="description" content="A VitePress site">
    <link rel="preload stylesheet" href="/notebook/assets/style.3dbfd0c2.css" as="style">
    
    <script type="module" src="/notebook/assets/app.8aaa4cbe.js"></script>
    <link rel="preload" href="/notebook/assets/inter-roman-latin.2ed14f66.woff2" as="font" type="font/woff2" crossorigin="">
    <link rel="modulepreload" href="/notebook/assets/chunks/framework.1336c4e5.js">
    <link rel="modulepreload" href="/notebook/assets/chunks/theme.20cddc0c.js">
    <link rel="modulepreload" href="/notebook/assets/Linux_软件部署.md.d6722925.lean.js">
    <script id="check-dark-light">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-255ec12d><!--[--><!--]--><!--[--><span tabindex="-1" data-v-ae3e3f51></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-ae3e3f51> Skip to content </a><!--]--><!----><header class="VPNav" data-v-255ec12d data-v-7e5bc4a5><div class="VPNavBar has-sidebar" data-v-7e5bc4a5 data-v-0937f67c><div class="container" data-v-0937f67c><div class="title" data-v-0937f67c><div class="VPNavBarTitle has-sidebar" data-v-0937f67c data-v-86d1bed8><a class="title" href="/notebook/" data-v-86d1bed8><!--[--><!--]--><!--[--><img class="VPImage logo" src="/notebook/Vue.png" alt data-v-8426fc1a><!--]--><!--[-->任硕的文档<!--]--><!--[--><!--]--></a></div></div><div class="content" data-v-0937f67c><div class="curtain" data-v-0937f67c></div><div class="content-body" data-v-0937f67c><!--[--><!--]--><div class="VPNavBarSearch search" style="--vp-meta-key:&#39;Meta&#39;;" data-v-0937f67c><!--[--><!----><div id="docsearch"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg class="DocSearch-Search-Icon" width="20" height="20" viewBox="0 0 20 20" aria-label="search icon"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"><kbd class="DocSearch-Button-Key"></kbd><kbd class="DocSearch-Button-Key">K</kbd></span></button></div><!--]--></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-0937f67c data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-a7b5672a><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-a7b5672a><span class="text" data-v-a7b5672a><!----><span data-v-a7b5672a>Java学前端</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-a7b5672a><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-a7b5672a><div class="VPMenu" data-v-a7b5672a data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><!----><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/Java%E5%AD%A6%E5%89%8D%E7%AB%AF/HTML+JS.html" data-v-2f2cfafc><!--[-->HTML+JS<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/Java%E5%AD%A6%E5%89%8D%E7%AB%AF/CSS.html" data-v-2f2cfafc><!--[-->CSS<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/Java%E5%AD%A6%E5%89%8D%E7%AB%AF/Vue2+%E7%BB%84%E4%BB%B6.html" data-v-2f2cfafc><!--[-->Vue2+组件<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/Java%E5%AD%A6%E5%89%8D%E7%AB%AF/Vue3+%E7%BB%84%E4%BB%B6.html" data-v-2f2cfafc><!--[-->Vue3+组件<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/Java%E5%AD%A6%E5%89%8D%E7%AB%AF/React.html" data-v-2f2cfafc><!--[-->React<!--]--></a></div><!--]--><!--]--></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-a7b5672a><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-a7b5672a><span class="text" data-v-a7b5672a><!----><span data-v-a7b5672a>软件测试</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-a7b5672a><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-a7b5672a><div class="VPMenu" data-v-a7b5672a data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><!----><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E8%BD%AF%E4%BB%B6%E6%B5%8B%E8%AF%95/%E6%B5%8B%E8%AF%95%E5%9F%BA%E7%A1%80.html" data-v-2f2cfafc><!--[-->测试基础<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E8%BD%AF%E4%BB%B6%E6%B5%8B%E8%AF%95/%E5%8E%8B%E5%8A%9B%E6%B5%8B%E8%AF%95.html" data-v-2f2cfafc><!--[-->压力测试<!--]--></a></div><!--]--><!--]--></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-a7b5672a><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-a7b5672a><span class="text" data-v-a7b5672a><!----><span data-v-a7b5672a>多线程</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-a7b5672a><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-a7b5672a><div class="VPMenu" data-v-a7b5672a data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><!----><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E5%B9%B6%E5%8F%91%20&amp;%20%E5%A4%9A%E7%BA%BF%E7%A8%8B/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-2f2cfafc><!--[-->基础篇<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E5%B9%B6%E5%8F%91%20&amp;%20%E5%A4%9A%E7%BA%BF%E7%A8%8B/%E5%B9%B6%E5%8F%91%E5%AE%8C%E5%96%84.html" data-v-2f2cfafc><!--[-->进阶篇<!--]--></a></div><!--]--><!--]--></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-a7b5672a><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-a7b5672a><span class="text" data-v-a7b5672a><!----><span data-v-a7b5672a>开发工具</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-a7b5672a><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-a7b5672a><div class="VPMenu" data-v-a7b5672a data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><!----><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/IDEA/Chrome.html" data-v-2f2cfafc><!--[-->Chrome<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/IDEA/IDEA%E5%9F%BA%E7%A1%80.html" data-v-2f2cfafc><!--[-->IDEA基础<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/IDEA/IDEA%E6%8F%92%E4%BB%B6.html" data-v-2f2cfafc><!--[-->IDEA插件<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/IDEA/VS%20Code.html" data-v-2f2cfafc><!--[-->VS Code<!--]--></a></div><!--]--><!--]--></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-7f418b0f data-v-a7b5672a><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-a7b5672a><span class="text" data-v-a7b5672a><!----><span data-v-a7b5672a>消息中间件</span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-a7b5672a><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-a7b5672a><div class="VPMenu" data-v-a7b5672a data-v-e7ea1737><div class="items" data-v-e7ea1737><!--[--><!--[--><div class="VPMenuGroup" data-v-e7ea1737 data-v-69e747b5><!----><!--[--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E6%B6%88%E6%81%AF%E4%B8%AD%E9%97%B4%E4%BB%B6/RabbitMQ.html" data-v-2f2cfafc><!--[-->RabbitMQ<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E6%B6%88%E6%81%AF%E4%B8%AD%E9%97%B4%E4%BB%B6/RocketMQ.html" data-v-2f2cfafc><!--[-->RocketMQ<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E6%B6%88%E6%81%AF%E4%B8%AD%E9%97%B4%E4%BB%B6/Kafka.html" data-v-2f2cfafc><!--[-->Kafka<!--]--></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-69e747b5 data-v-2f2cfafc><a class="VPLink link" href="/notebook/%E6%B6%88%E6%81%AF%E4%B8%AD%E9%97%B4%E4%BB%B6/Canal.html" data-v-2f2cfafc><!--[-->Canal<!--]--></a></div><!--]--><!--]--></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-0937f67c data-v-f6a63727><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-f6a63727 data-v-82b282f1 data-v-f3c41672><span class="check" data-v-f3c41672><span class="icon" data-v-f3c41672><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-82b282f1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-82b282f1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-0937f67c data-v-0394ad82 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/renshuo123/renshuo123.github.io" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><a class="VPSocialLink no-icon" href="#" aria-label="twitter" target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg></a><a class="VPSocialLink no-icon" href="https://github.com/" aria-label target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg t="1676028692954" class="icon" ...</path></svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-0937f67c data-v-40855f84 data-v-a7b5672a><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-a7b5672a><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-a7b5672a><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-a7b5672a><div class="VPMenu" data-v-a7b5672a data-v-e7ea1737><!----><!--[--><!--[--><!----><div class="group" data-v-40855f84><div class="item appearance" data-v-40855f84><p class="label" data-v-40855f84>Appearance</p><div class="appearance-action" data-v-40855f84><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="toggle dark mode" aria-checked="false" data-v-40855f84 data-v-82b282f1 data-v-f3c41672><span class="check" data-v-f3c41672><span class="icon" data-v-f3c41672><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-82b282f1><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-82b282f1><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><div class="group" data-v-40855f84><div class="item social-links" data-v-40855f84><div class="VPSocialLinks social-links-list" data-v-40855f84 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/renshuo123/renshuo123.github.io" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><a class="VPSocialLink no-icon" href="#" aria-label="twitter" target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg></a><a class="VPSocialLink no-icon" href="https://github.com/" aria-label target="_blank" rel="noopener" data-v-7bc22406 data-v-f80f8133><svg t="1676028692954" class="icon" ...</path></svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-0937f67c data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><!----></header><div class="VPLocalNav reached-top" data-v-255ec12d data-v-5cfd5582><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-5cfd5582><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-5cfd5582><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-5cfd5582>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-5cfd5582 data-v-18201f51><button data-v-18201f51>Return to top</button><!----></div></div><aside class="VPSidebar" data-v-255ec12d data-v-845b8fc6><div class="curtain" data-v-845b8fc6></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-845b8fc6><span class="visually-hidden" id="sidebar-aria-label" data-v-845b8fc6> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>Java</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Java/Java%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Java基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Java/Java%E6%96%B0%E7%89%B9%E6%80%A7.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Java新特性</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Java/Java%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Java进阶</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Java/Java%E9%9B%86%E5%90%88.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Java集合</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Java/Java%E9%AB%98%E7%BA%A7.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Java高级</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible has-active" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>Linux</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Linux/Linux%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Linux基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Linux/Linux%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Linux新特性</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Linux/Shell.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Shell脚本</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Linux/%E5%AE%9E%E7%94%A8%E8%84%9A%E6%9C%AC.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>实用脚本</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Linux/%E8%BD%AF%E4%BB%B6%E9%83%A8%E7%BD%B2.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>软件部署</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>Nginx</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Nginx/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>基础篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Nginx/%E8%BF%9B%E9%98%B6%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>进阶篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Nginx/%E5%AE%9E%E6%88%98%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>实战篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Nginx/%E9%9D%A2%E8%AF%95%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>面试篇</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>SSM</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/SSM/Maven.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Maven</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/SSM/Spring.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Spring</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/SSM/SpringMVC.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>SpringMVC</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/SSM/SpringBatch.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>SpringBatch</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>SpringBoot</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/3%E3%80%81SpringBoot/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>基础篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/3%E3%80%81SpringBoot/%E5%BA%94%E7%94%A8%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>应用篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/3%E3%80%81SpringBoot/%E6%96%B0%E7%89%B9%E6%80%A7.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>新特性</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/3%E3%80%81SpringBoot/%E8%BF%90%E7%BB%B4&amp;%E5%8E%9F%E7%90%86.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>运维&原理</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>SpringCloud</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/4%E3%80%81%E5%BE%AE%E6%9C%8D%E5%8A%A1/%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>SpringCloud</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/4%E3%80%81%E5%BE%AE%E6%9C%8D%E5%8A%A1/%E5%BF%85%E5%A4%87/Sentinel.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Sentinel</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>SpringSecurity</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/4%E3%80%81%E5%BE%AE%E6%9C%8D%E5%8A%A1/SpringSecurity/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>SpringSecurity基础篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/4%E3%80%81%E5%BE%AE%E6%9C%8D%E5%8A%A1/SpringSecurity/%E8%BF%9B%E9%98%B6%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>SpringSecurity进阶篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/4%E3%80%81%E5%BE%AE%E6%9C%8D%E5%8A%A1/SpringSecurity/%E9%AB%98%E7%BA%A7%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>SpringSecurity高级篇</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>Mybatis & MybatisPlus</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Mybatis&amp;MybatisPlus/Mybatis.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Mybatis</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Mybatis&amp;MybatisPlus/MybatisPlus.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MybatisPlus</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/Mybatis&amp;MybatisPlus/JPA.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>JPA</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>Git & ChatGPT</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/5%E3%80%81%E8%BF%90%E7%BB%B4/Git.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Git</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/5%E3%80%81%E8%BF%90%E7%BB%B4/Github.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Github</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/5%E3%80%81%E8%BF%90%E7%BB%B4/ChatGPT.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>ChatGPT</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/5%E3%80%81%E8%BF%90%E7%BB%B4/Jenkins.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Jenkins</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/5%E3%80%81%E8%BF%90%E7%BB%B4/Netty.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Netty</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>数据库</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>MySQL</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MySQL/MySQL%E6%A0%B8%E5%BF%83/%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MySQL基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MySQL/MySQL%E6%A0%B8%E5%BF%83/%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MySQL进阶</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MySQL/MySQL%E6%A0%B8%E5%BF%83/%E4%BC%98%E5%8C%96.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MySQL优化</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MySQL/MySQL%E6%A0%B8%E5%BF%83/%E8%AE%BE%E8%AE%A1.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MySQL设计</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MySQL/MySQL%E6%A0%B8%E5%BF%83/%E8%BF%90%E7%BB%B4.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MySQL运维</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MySQL/%E5%88%86%E5%BA%93%E5%88%86%E8%A1%A8.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>分库分表</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>Redis</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/Redis/Redis%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Redis基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/Redis/Redis%E4%BC%98%E5%8C%96.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Redis优化</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/Redis/Redis%E5%8E%9F%E7%90%86.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Redis原理</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/Redis/Redis%E9%AB%98%E7%BA%A7.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Redis高级</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/Redis/Redis%E5%AE%9E%E6%88%98.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Redis实战</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/Redis/%E6%9C%AC%E5%9C%B0%E7%BC%93%E5%AD%98.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>本地缓存</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>MongoDB</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MongoDB/%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MongoDB基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/MongoDB/%E6%95%B4%E5%90%88.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>MongoDB进阶</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>ElasticSearch</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/ElasticSearch/1%E3%80%81ES%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>ES基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/ElasticSearch/3%E3%80%81ES%E9%AB%98%E7%BA%A7.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>ES高级</p><!--]--></a><!----></div><!----></div><!--]--></div></section><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/influxdb.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>InfluxDB</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/2%E3%80%81%E6%95%B0%E6%8D%AE%E5%BA%93/Neo4j.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Neo4j</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>高并发 & 秒杀 & 分布式</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E4%B8%89%E9%AB%98/%E5%88%86%E5%B8%83%E5%BC%8F.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>分布式理论</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/4%E3%80%81%E5%BE%AE%E6%9C%8D%E5%8A%A1/%E5%BF%85%E5%A4%87/%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>分布式锁</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E4%B8%89%E9%AB%98/%E7%A7%92%E6%9D%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>秒杀</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E4%B8%89%E9%AB%98/%E9%AB%98%E5%8F%AF%E7%94%A8.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>高可用</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E4%B8%89%E9%AB%98/%E9%AB%98%E5%B9%B6%E5%8F%91.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>高并发</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>云原生</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E4%BA%91%E5%8E%9F%E7%94%9F/Docker.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Docker</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E4%BA%91%E5%8E%9F%E7%94%9F/K8S.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>K8S</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>可视化 & 监控</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E5%8F%AF%E8%A7%86%E5%8C%96%20&amp;%20%E7%9B%91%E6%8E%A7/%E7%9B%91%E6%8E%A7%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>监控基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E5%8F%AF%E8%A7%86%E5%8C%96%20&amp;%20%E7%9B%91%E6%8E%A7/%E7%9B%91%E6%8E%A7%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>监控进阶</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E5%8F%AF%E8%A7%86%E5%8C%96%20&amp;%20%E7%9B%91%E6%8E%A7/%E5%8F%AF%E8%A7%86%E5%8C%96%E5%A4%A7%E5%B1%8F.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>可视化大屏</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E5%8F%AF%E8%A7%86%E5%8C%96%20&amp;%20%E7%9B%91%E6%8E%A7/Zabbix.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Zabbix</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>学前端</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>HTML+CSS</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/1%E3%80%81HTML+CSS/HTML%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>HTML基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/1%E3%80%81HTML+CSS/CSS%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>CSS基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/1%E3%80%81HTML+CSS/%E7%BD%91%E9%A1%B5%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>网页进阶</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>JS+TS</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/2%E3%80%81JS+TS/JS%20%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>JS基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/2%E3%80%81JS+TS/JS%20%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>JS进阶</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/2%E3%80%81JS+TS/ES6%20%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>ES6基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/2%E3%80%81JS+TS/ES6%20%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>ES6进阶</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/2%E3%80%81JS+TS/TypeScript.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>TS基础</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>NodeJS</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/4%E3%80%81Node/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Node基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/4%E3%80%81Node/%E8%BF%9B%E9%98%B6%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Node进阶</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/4%E3%80%81Node/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>项目实战</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>Vue</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/3%E3%80%81Vue/Vue3/Vue3%E8%BF%9B%E9%98%B6.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Vue3进阶</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/3%E3%80%81Vue/Vue3/Vue3%E9%AB%98%E7%BA%A7.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Vue3高级</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/3%E3%80%81Vue/Vue3/Vue3%E6%96%B0%E8%AF%AD%E6%B3%95.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>Vue3新语法</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/3%E3%80%81Vue/Vue2/Vue2%E9%A1%B9%E7%9B%AE.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>项目实战</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>小程序</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/5%E3%80%81%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>小程序基础</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/5%E3%80%81%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E4%BC%98%E5%8C%96.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>小程序优化</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/5%E3%80%81%E5%B0%8F%E7%A8%8B%E5%BA%8F/uniapp.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>uniapp</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/1%E3%80%81%E5%AD%A6%E5%89%8D%E7%AB%AF/5%E3%80%81%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%B0%8F%E7%A8%8B%E5%BA%8F%E9%A1%B9%E7%9B%AE.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>项目实战</p><!--]--></a><!----></div><!----></div><!--]--></div></section><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>计算机基础</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>数据结构</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>操作系统</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>设计模式</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C/%E7%BD%91%E7%BB%9C%E5%9F%BA%E7%A1%80.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>计算机网络</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/UML.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>UML</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80/%E7%AE%97%E6%B3%95/LeetCode.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>LeetCode</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0 collapsible collapsed" data-v-845b8fc6 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h2 class="text" data-v-9b797284>项目实战</h2><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>云尚办公</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E4%BA%91%E5%B0%9A%E5%8A%9E%E5%85%AC/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>基础篇</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>小兔鲜</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E5%B0%8F%E5%85%94%E9%B2%9C/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>基础篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E5%B0%8F%E5%85%94%E9%B2%9C/%E8%BF%9B%E9%98%B6%E7%AF%871.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>进阶篇1</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E5%B0%8F%E5%85%94%E9%B2%9C/%E8%BF%9B%E9%98%B6%E7%AF%872.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>进阶篇2</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>地图</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E7%99%BE%E5%BA%A6%E5%9C%B0%E5%9B%BE/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>基础篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E7%99%BE%E5%BA%A6%E5%9C%B0%E5%9B%BE/%E8%BF%9B%E9%98%B6%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>进阶篇</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>苍穹外卖</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E8%8B%8D%E7%A9%B9%E5%A4%96%E5%8D%96/%E8%BF%9B%E9%98%B6%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>进阶篇</p><!--]--></a><!----></div><!----></div><!--]--></div></section><section class="VPSidebarItem level-1 collapsible collapsed" data-v-9b797284 data-v-9b797284><div class="item" role="button" tabindex="0" data-v-9b797284><div class="indicator" data-v-9b797284></div><h3 class="text" data-v-9b797284>黑马头条</h3><div class="caret" role="button" aria-label="toggle section" tabindex="0" data-v-9b797284><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="caret-icon" data-v-9b797284><path d="M9,19c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l5.3-5.3L8.3,6.7c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l6,6c0.4,0.4,0.4,1,0,1.4l-6,6C9.5,18.9,9.3,19,9,19z"></path></svg></div></div><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E9%BB%91%E9%A9%AC%E5%A4%B4%E6%9D%A1/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>基础篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E9%BB%91%E9%A9%AC%E5%A4%B4%E6%9D%A1/%E8%BF%9B%E9%98%B6%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>进阶篇</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E9%BB%91%E9%A9%AC%E5%A4%B4%E6%9D%A1/%E8%BF%9B%E9%98%B6%E7%AF%872.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>进阶篇2</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-2 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E9%BB%91%E9%A9%AC%E5%A4%B4%E6%9D%A1/%E9%AB%98%E7%BA%A7%E7%AF%87.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>高级篇</p><!--]--></a><!----></div><!----></div><!--]--></div></section><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E6%94%AF%E4%BB%98.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>支付</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/%E9%A1%B9%E7%9B%AE%E5%AE%9E%E6%88%98/%E9%A1%B9%E7%9B%AE%E6%8E%A8%E8%8D%90.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>项目推荐</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-845b8fc6><section class="VPSidebarItem level-0" data-v-845b8fc6 data-v-9b797284><!----><div class="items" data-v-9b797284><!--[--><div class="VPSidebarItem level-1 is-link" data-v-9b797284 data-v-9b797284><div class="item" data-v-9b797284><div class="indicator" data-v-9b797284></div><a class="VPLink link link" href="/notebook/team.html" data-v-9b797284><!--[--><p class="text" data-v-9b797284>团队成员</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-255ec12d data-v-669faec9><div class="VPDoc has-sidebar has-aside" data-v-669faec9 data-v-6b87e69f><!--[--><!--]--><div class="container" data-v-6b87e69f><div class="aside" data-v-6b87e69f><div class="aside-curtain" data-v-6b87e69f></div><div class="aside-container" data-v-6b87e69f><div class="aside-content" data-v-6b87e69f><div class="VPDocAside" data-v-6b87e69f data-v-3f215769><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" data-v-3f215769 data-v-ff0f39c8><div class="content" data-v-ff0f39c8><div class="outline-marker" data-v-ff0f39c8></div><div class="outline-title" data-v-ff0f39c8>On this page</div><nav aria-labelledby="doc-outline-aria-label" data-v-ff0f39c8><span class="visually-hidden" id="doc-outline-aria-label" data-v-ff0f39c8> Table of Contents for current page </span><ul class="root" data-v-ff0f39c8 data-v-d0ee3533><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-6b87e69f><div class="content-container" data-v-6b87e69f><!--[--><!--]--><!----><main class="main" data-v-6b87e69f><div style="position:relative;" class="vp-doc _notebook_Linux_%E8%BD%AF%E4%BB%B6%E9%83%A8%E7%BD%B2" data-v-6b87e69f><div><p>实战章节：在Linux上部署各类软件</p><h1 id="前言" tabindex="-1">前言 <a class="header-anchor" href="#前言" aria-label="Permalink to &quot;前言&quot;">​</a></h1><h2 id="为什么学习各类软件在linux上的部署" tabindex="-1">为什么学习各类软件在Linux上的部署 <a class="header-anchor" href="#为什么学习各类软件在linux上的部署" aria-label="Permalink to &quot;为什么学习各类软件在Linux上的部署&quot;">​</a></h2><p>在前面，我们学习了许多的Linux命令和高级技巧，这些知识点比较零散，同学们跟随着课程的内容进行练习虽然可以基础掌握这些命令和技巧的使用，但是并没有一些具体的实操能够串联起来这些知识点。</p><p>所以，现在我们设计了各类软件在Linux上部署安装的实战章节，可以让同学们：</p><ul><li>对前面学习的各类操作命令进行复习和练习，从而深度掌握它们</li><li>本章节中演示部署的软件，包含了IT行业各类岗位中所必须使用的，如：Java后台、大数据开发、运维开发、测试、AI等。无论学习Linux后从事什么岗位，这些内容都会给你带来帮助</li></ul><blockquote><p>对于零基础学员，实战课程中所讲解的软件大概率多数大家并不了解。</p><p>所以，课程仅涉及到安装部署，不对软件的使用做详细说明。</p><p>同学们在这个过程中，可能会遇到各种各样的错误，<code>不要怕</code>，解决它，将会给你带来极大的提升。</p></blockquote><h3 id="学习目标" tabindex="-1">学习目标 <a class="header-anchor" href="#学习目标" aria-label="Permalink to &quot;学习目标&quot;">​</a></h3><p>对于本部分的内容学习，我们设计两个目标：</p><ul><li><p>对于零基础或未从业的学员，不要求深入理解所安装部署的软件是什么，仅仅能够跟随课程成功的将其部署安装并运行成功即可</p><p>在这个过程中，主要锻炼大家对Linux操作系统的熟练度，此乃零基础未从业学员的第一学习目标</p></li><li><p>对于有基础或已从业的学员，本章节讲解的软件涵盖了大多数IT从业者所能接触到的，特别是大数据开发、后端开发两个主流方向，可以作为参考资料，以便在工作中有所帮助。</p></li></ul><p>本章节内的各类软件安装，==不强制要求全部学习==</p><ol><li>零基础学员，建议全部学习，作为前面学习内容的总结和实战</li><li>IT从业者、有经验学员，可以按需选择，选择工作中需要用到的进行学习</li></ol><blockquote><p>章节内包含的软件并非100%涵盖了IT开发领域中所需要的内容。</p><p>如果您对某些软件的安装有强烈需求，且课程中没有提供教程，可以私信B站：&quot;黑马大数据曹老师&quot;，老师会酌情根据时间安排补充上去哦。</p></blockquote><h2 id="为什么不使用ppt而是使用文档进行授课" tabindex="-1">为什么不使用PPT而是使用文档进行授课 <a class="header-anchor" href="#为什么不使用ppt而是使用文档进行授课" aria-label="Permalink to &quot;为什么不使用PPT而是使用文档进行授课&quot;">​</a></h2><p>从现在开始，将要进入到Linux的实操阶段，在这个阶段我们将会涉及到非常多的软件部署等操作，涉及到：</p><ul><li>各类命令的使用</li><li>各种过程的结果</li><li>复杂的流程步骤</li><li>等</li></ul><p>这些信息的展示，并不适合于使用PPT作为载体进行授课，所以从现在开始我们将使用操作文档的模式为大家进行讲解。</p><blockquote><p>使用文档模式还有一个好处，除了学习视频以外，拿到课程中使用的操作文档，同样可以作为重要的参考手册进行使用。</p><p>一举两得</p></blockquote><h2 id="前置要求" tabindex="-1">前置要求 <a class="header-anchor" href="#前置要求" aria-label="Permalink to &quot;前置要求&quot;">​</a></h2><ol><li>实战章节要求同学们==务必全部学习前面的知识点==，即：初识Linux、Linux基础命令、Linux权限管理、Linux高阶技巧这4个章节，请勿跳过前面的章节学习实战章节。</li><li>实战章节中会开启多台虚拟机，请尽量确保电脑的内存在：8GB（包含8GB）以上。如内存不足可以扩充内存条或购买阿里云、UCloud等云服务器临时使用（1个月多台低配服务器几十块左右）</li></ol><blockquote><p>对于云平台上购买服务器，可以参阅最后的章节（云服务）</p></blockquote><h2 id="注意" tabindex="-1">注意 <a class="header-anchor" href="#注意" aria-label="Permalink to &quot;注意&quot;">​</a></h2><p>下面全部的软件安装的相关流程，90%都是取自软件自身的官方网站。</p><p>一个合格的程序员要有良好的信息收集能力哦</p><h1 id="linux安装" tabindex="-1">Linux安装 <a class="header-anchor" href="#linux安装" aria-label="Permalink to &quot;Linux安装&quot;">​</a></h1><h2 id="ubuntu安装" tabindex="-1">Ubuntu安装 <a class="header-anchor" href="#ubuntu安装" aria-label="Permalink to &quot;Ubuntu安装&quot;">​</a></h2><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 新进入必须重新设置root密码</span></span>
<span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">passwd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">root</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 输入两次密码，即可进入root权限</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 查看端口号</span></span>
<span class="line"><span style="color:#FFCB6B;">apt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">net-tools</span></span>
<span class="line"><span style="color:#FFCB6B;">ifconfig</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 关闭防火墙</span></span>
<span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">ufw</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 配置Finalshell远程连接</span></span>
<span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">apt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">openssh-server</span></span>
<span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/init.d/ssh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span></span>
<span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/init.d/ssh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">startsudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/init.d/ssh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span></span>
<span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">gedit</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/ssh/sshd_config</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 将如下指令进行修改PermitRootLogin yes</span></span>
<span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/init.d/ssh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">restart</span></span></code></pre></div><p>配置Ubuntu镜像源[原来的下载太慢了]</p><p>第一步：</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/apt/sources.list</span></span></code></pre></div><p>第二步：输入以下镜像源</p><div class="language-objectivec"><button title="Copy Code" class="copy"></button><span class="lang">objectivec</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;"># 腾讯云的镜像源</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.tencentyun.com/ubuntu/ xenial main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.tencentyun.com/ubuntu/ xenial-security main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.tencentyun.com/ubuntu/ xenial-updates main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.tencentyun.com/ubuntu/ xenial main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.tencentyun.com/ubuntu/ xenial-security main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.tencentyun.com/ubuntu/ xenial-updates main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;"># 阿里的镜像源</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse </span></span>
<span class="line"><span style="color:#A6ACCD;"># 清华大学的镜像源，默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释</span></span>
<span class="line"><span style="color:#A6ACCD;">deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;"># deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;"># deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;"># deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;">deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse</span></span>
<span class="line"><span style="color:#A6ACCD;"># deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse</span></span></code></pre></div><p>第三步：</p><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">sudo apt</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">get</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">update</span></span></code></pre></div><p>现在开发&amp;运维对镜像源的要求不高了。但是如果是初始化机器的运行环境，镜像源还是很有用的。</p><h1 id="mysql-安装部署【简单】" tabindex="-1">MySQL 安装部署【简单】 <a class="header-anchor" href="#mysql-安装部署【简单】" aria-label="Permalink to &quot;MySQL 安装部署【简单】&quot;">​</a></h1><h2 id="简介" tabindex="-1">简介 <a class="header-anchor" href="#简介" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>MySQL数据库管理系统（后续简称MySQL），是一款知名的数据库系统，其特点是：轻量、简单、功能丰富。</p><p>MySQL数据库可谓是软件行业的明星产品，无论是后端开发、大数据、AI、运维、测试等各类岗位，基本上都会和MySQL打交道。</p><p>让我们从MySQL开始，进行实战的Linux软件安装部署。</p><p>本次课程分为2个版本进行安装：</p><ul><li>MySQL 5.7版本安装</li><li>MySQL 8.x版本安装</li></ul><blockquote><p>由于MySQL5.x和8.x各自有许多使用者，所以这两个版本我们都演示安装一遍</p></blockquote><h2 id="mysql5-7在centos安装" tabindex="-1">MySQL5.7在CentOS安装 <a class="header-anchor" href="#mysql5-7在centos安装" aria-label="Permalink to &quot;MySQL5.7在CentOS安装&quot;">​</a></h2><blockquote><p>注意：安装操作需要root权限</p></blockquote><p>MySQL的安装我们可以通过前面学习的yum命令进行。</p><h3 id="_1-下载和安装" tabindex="-1">1 下载和安装 <a class="header-anchor" href="#_1-下载和安装" aria-label="Permalink to &quot;1 下载和安装&quot;">​</a></h3><h4 id="_1-配置yum仓库" tabindex="-1">1 配置yum仓库 <a class="header-anchor" href="#_1-配置yum仓库" aria-label="Permalink to &quot;1 配置yum仓库&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 更新密钥</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--import</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://repo.mysql.com/RPM-GPG-KEY-mysql-2022</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 安装MySQL yum库</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-Uvh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm</span></span></code></pre></div><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/12/20221012182514.png" alt="image-20221012182514865" style="zoom:80%;"><blockquote><p>由于MySQL并不在CentOS的官方仓库中，所以我们通过上述rpm命令：</p><ul><li>导入MySQL仓库的密钥</li><li>配置MySQLQ的yum仓库</li></ul></blockquote><h4 id="_2-使用yum安装mysql" tabindex="-1">2 使用yum安装MySQL <a class="header-anchor" href="#_2-使用yum安装mysql" aria-label="Permalink to &quot;2 使用yum安装MySQL&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># yum安装Mysql</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-community-server</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062121011.png" alt="image-20221106212105868" style="zoom:80%;"><h4 id="_3-配置开机自启动" tabindex="-1">3 配置开机自启动 <a class="header-anchor" href="#_3-配置开机自启动" aria-label="Permalink to &quot;3 配置开机自启动&quot;">​</a></h4><p>安装完成后，启动MySQL并配置开机自启动</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 启动</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 开机自启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span><span style="color:#A6ACCD;">      </span><span style="color:#676E95;font-style:italic;"># 停止</span></span></code></pre></div><blockquote><p>MySQL安装完成后，会自动配置为名称叫做：<code>mysqld</code>的服务，可以被systemctl所管理</p></blockquote><h4 id="_4-检查mysql的运行状态" tabindex="-1">4 检查MySQL的运行状态 <a class="header-anchor" href="#_4-检查mysql的运行状态" aria-label="Permalink to &quot;4 检查MySQL的运行状态&quot;">​</a></h4><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062116457.png" alt="image-20221106211615326" style="zoom:80%;"><h3 id="_2-配置密码和ip" tabindex="-1">2 配置密码和IP <a class="header-anchor" href="#_2-配置密码和ip" aria-label="Permalink to &quot;2 配置密码和IP&quot;">​</a></h3><p>主要配置管理员用户root的密码以及配置允许远程登录的权限。</p><h4 id="_1-获取mysql的初始密码" tabindex="-1">1 获取MySQL的初始密码 <a class="header-anchor" href="#_1-获取mysql的初始密码" aria-label="Permalink to &quot;1 获取MySQL的初始密码&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 通过grep命令，在/var/log/mysqld.log文件中，过滤temporary password关键字，得到初始密码</span></span>
<span class="line"><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">temporary password</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/var/log/mysqld.log</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062116281.png" alt="image-20221106211642215" style="zoom:80%;"><h4 id="_2-登陆mysql数据库系统" tabindex="-1">2 登陆MySQL数据库系统 <a class="header-anchor" href="#_2-登陆mysql数据库系统" aria-label="Permalink to &quot;2 登陆MySQL数据库系统&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 执行</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-uroot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 解释</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># -u，登陆的用户，MySQL数据库的管理员用户同Linux一样，是root</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># -p，表示使用密码登陆</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 执行完毕后输入刚刚得到的初始密码，即可进入MySQL数据库</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062117924.png" alt="image-20221106211709801" style="zoom:80%;"><h4 id="_3-修改root用户密码" tabindex="-1">3 修改root用户密码 <a class="header-anchor" href="#_3-修改root用户密码" aria-label="Permalink to &quot;3 修改root用户密码&quot;">​</a></h4><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;"># 在MySQL控制台内执行</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">-- 密码需要符合：大于8位，有大写字母，有特殊符号，不能是连续的简单语句如123，abc</span></span>
<span class="line"><span style="color:#F78C6C;">ALTER</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">USER</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> IDENTIFIED </span><span style="color:#F78C6C;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">密码</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span></code></pre></div><h4 id="_4-扩展-配置root的简单密码" tabindex="-1">4 [扩展] 配置root的简单密码 <a class="header-anchor" href="#_4-扩展-配置root的简单密码" aria-label="Permalink to &quot;4 [扩展] 配置root的简单密码&quot;">​</a></h4><blockquote><p>我们可以给root设置简单密码，如123456.</p><p>请注意，此配置仅仅是用于测试环境或学习环境的MySQL，如果是正式使用，请勿设置简单密码</p></blockquote><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;"># 如果你想设置简单密码，需要降低Mysql的密码安全级别</span></span>
<span class="line"><span style="color:#F78C6C;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">global</span><span style="color:#A6ACCD;"> validate_password_policy</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">LOW; # 密码安全级别低</span></span>
<span class="line"><span style="color:#F78C6C;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">global</span><span style="color:#A6ACCD;"> validate_password_length</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">4</span><span style="color:#A6ACCD;">;	 # 密码长度最低4位即可</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;"># 然后就可以用简单密码了（课程中使用简单密码，为了方便，生产中不要这样）</span></span>
<span class="line"><span style="color:#F78C6C;">ALTER</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">USER</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> IDENTIFIED </span><span style="color:#F78C6C;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">简单密码</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span></code></pre></div><h4 id="_5-扩展-配置root运行远程登录" tabindex="-1">5 [扩展] 配置root运行远程登录 <a class="header-anchor" href="#_5-扩展-配置root运行远程登录" aria-label="Permalink to &quot;5 [扩展] 配置root运行远程登录&quot;">​</a></h4><blockquote><p>默认情况下，root用户是不运行远程登录的，只允许在MySQL所在的Linux服务器登陆MySQL系统</p><p>请注意，允许root远程登录会带来安全风险</p></blockquote><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;"># 授权root远程登录</span></span>
<span class="line"><span style="color:#F78C6C;">grant</span><span style="color:#A6ACCD;"> all privileges </span><span style="color:#F78C6C;">on</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;">.</span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">to</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">root</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">IP地址</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> identified </span><span style="color:#F78C6C;">by</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">密码</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">with</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">grant</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">option</span><span style="color:#A6ACCD;">;  </span></span>
<span class="line"><span style="color:#A6ACCD;"># IP地址即允许登陆的IP地址，也可以填写%，表示允许任何地址</span></span>
<span class="line"><span style="color:#F78C6C;">grant</span><span style="color:#A6ACCD;"> all privileges </span><span style="color:#F78C6C;">on</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;">.</span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">to</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">root</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> identified </span><span style="color:#F78C6C;">by</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">315217</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">with</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">grant</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">option</span><span style="color:#A6ACCD;">; </span></span>
<span class="line"><span style="color:#A6ACCD;"># 密码表示给远程登录独立设置密码，和本地登陆的密码可以不同</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;"># 刷新权限，生效</span></span>
<span class="line"><span style="color:#A6ACCD;">flush privileges;</span></span></code></pre></div><h4 id="_6-退出mysql控制台页面" tabindex="-1">6 退出MySQL控制台页面 <a class="header-anchor" href="#_6-退出mysql控制台页面" aria-label="Permalink to &quot;6 退出MySQL控制台页面&quot;">​</a></h4><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;"># 退出命令</span></span>
<span class="line"><span style="color:#A6ACCD;">exit</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;"># 或者通过快捷键退出：ctrl </span><span style="color:#89DDFF;">+</span><span style="color:#A6ACCD;"> d</span></span></code></pre></div><h4 id="_7-检查端口" tabindex="-1">7 检查端口 <a class="header-anchor" href="#_7-检查端口" aria-label="Permalink to &quot;7 检查端口&quot;">​</a></h4><p>MySQL默认绑定了3306端口，可以通过端口占用检查MySQL的网络状态</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">netstat</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-anp</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">3306</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062119027.png" alt="image-20221106211925955" style="zoom:80%;"><p>至此，MySQL就安装完成并可用了，请妥善保存好MySQL的root密码。</p><h2 id="mysql8-0-在centos安装" tabindex="-1">MySQL8.0 在CentOS安装 <a class="header-anchor" href="#mysql8-0-在centos安装" aria-label="Permalink to &quot;MySQL8.0 在CentOS安装&quot;">​</a></h2><blockquote><p>注意：安装操作需要root权限</p></blockquote><h3 id="_1-下载和安装-1" tabindex="-1">1 下载和安装 <a class="header-anchor" href="#_1-下载和安装-1" aria-label="Permalink to &quot;1 下载和安装&quot;">​</a></h3><h4 id="_1-配置yum仓库-1" tabindex="-1">1 配置yum仓库 <a class="header-anchor" href="#_1-配置yum仓库-1" aria-label="Permalink to &quot;1 配置yum仓库&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 更新密钥</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--import</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://repo.mysql.com/RPM-GPG-KEY-mysql-2022</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 安装Mysql8.x版本 yum库</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-Uvh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm</span></span></code></pre></div><h4 id="_2-使用yum安装mysql-1" tabindex="-1">2 使用yum安装MySQL <a class="header-anchor" href="#_2-使用yum安装mysql-1" aria-label="Permalink to &quot;2 使用yum安装MySQL&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># yum安装Mysql</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">clean</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">all</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">makecache</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-community-server</span></span></code></pre></div><h4 id="_3-配置开机自启动-1" tabindex="-1">3 配置开机自启动 <a class="header-anchor" href="#_3-配置开机自启动-1" aria-label="Permalink to &quot;3 配置开机自启动&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 启动,开机自启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span><span style="color:#A6ACCD;">		</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span></span></code></pre></div><blockquote><p>MySQL安装完成后，会自动配置为名称叫做：<code>mysqld</code>的服务，可以被systemctl所管理</p></blockquote><h4 id="_4-检查mysql的运行状态-1" tabindex="-1">4 检查MySQL的运行状态 <a class="header-anchor" href="#_4-检查mysql的运行状态-1" aria-label="Permalink to &quot;4 检查MySQL的运行状态&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062143382.png" alt="image-20221106214351238" style="zoom:80%;"><h3 id="_2-配置密码和ip-1" tabindex="-1">2 配置密码和IP <a class="header-anchor" href="#_2-配置密码和ip-1" aria-label="Permalink to &quot;2 配置密码和IP&quot;">​</a></h3><p>主要修改root密码和允许root远程登录</p><h4 id="_1-获取mysql的初始密码-1" tabindex="-1">1 获取MySQL的初始密码 <a class="header-anchor" href="#_1-获取mysql的初始密码-1" aria-label="Permalink to &quot;1 获取MySQL的初始密码&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 通过grep命令，在/var/log/mysqld.log文件中，过滤temporary password关键字，得到初始密码</span></span>
<span class="line"><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">temporary password</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/var/log/mysqld.log</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062146975.png" alt="image-20221106214626911" style="zoom:80%;"><h4 id="_2-登录mysql数据库系统" tabindex="-1">2 登录MySQL数据库系统 <a class="header-anchor" href="#_2-登录mysql数据库系统" aria-label="Permalink to &quot;2 登录MySQL数据库系统&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 执行</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-uroot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 解释</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># -u，登陆的用户，MySQL数据库的管理员用户同Linux一样，是root</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># -p，表示使用密码登陆</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 执行完毕后输入刚刚得到的初始密码，即可进入MySQL数据库</span></span></code></pre></div><h4 id="_3-修改root密码" tabindex="-1">3 修改root密码 <a class="header-anchor" href="#_3-修改root密码" aria-label="Permalink to &quot;3 修改root密码&quot;">​</a></h4><blockquote><p>我们可以给root设置简单密码，如123456.</p><p>请注意，此配置仅仅是用于测试环境或学习环境的MySQL，如果是正式使用，请勿设置简单密码</p></blockquote><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;">-- 密码需要符合：大于8位，有大写字母，有特殊符号，不能是连续的简单语句如123，abc</span></span>
<span class="line"><span style="color:#F78C6C;">ALTER</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">USER</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> IDENTIFIED </span><span style="color:#F78C6C;">WITH</span><span style="color:#A6ACCD;"> mysql_native_password </span><span style="color:#F78C6C;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">315217renS.</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;	</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">-- 再次修改密码：密码安全级别低,密码长度最低4位即可</span></span>
<span class="line"><span style="color:#F78C6C;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">global</span><span style="color:#A6ACCD;"> validate_password.policy</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">0</span><span style="color:#A6ACCD;">;		</span></span>
<span class="line"><span style="color:#F78C6C;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">global</span><span style="color:#A6ACCD;"> validate_password.length</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">4</span><span style="color:#A6ACCD;">;		</span></span>
<span class="line"><span style="color:#F78C6C;">ALTER</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">USER</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> IDENTIFIED </span><span style="color:#F78C6C;">WITH</span><span style="color:#A6ACCD;"> mysql_native_password </span><span style="color:#F78C6C;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">123456</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span></code></pre></div><h4 id="_5-允许root远程登录" tabindex="-1">5 允许root远程登录 <a class="header-anchor" href="#_5-允许root远程登录" aria-label="Permalink to &quot;5 允许root远程登录&quot;">​</a></h4><blockquote><p>默认情况下，root用户是不运行远程登录的，只允许在MySQL所在的Linux服务器登陆MySQL系统</p><p>请注意，允许root远程登录会带来安全风险</p></blockquote><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#F78C6C;">use</span><span style="color:#A6ACCD;"> mysql</span></span>
<span class="line"><span style="color:#F78C6C;">update</span><span style="color:#A6ACCD;"> user </span><span style="color:#F78C6C;">set</span><span style="color:#A6ACCD;"> host</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">where</span><span style="color:#A6ACCD;"> user</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span>
<span class="line"><span style="color:#F78C6C;">grant</span><span style="color:#A6ACCD;"> all privileges </span><span style="color:#F78C6C;">on</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;">.</span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">to</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">root</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span>
<span class="line"><span style="color:#F78C6C;">SELECT</span><span style="color:#A6ACCD;"> User, Host </span><span style="color:#F78C6C;">FROM</span><span style="color:#A6ACCD;"> user;</span></span></code></pre></div><h3 id="创建用户" tabindex="-1">创建用户 <a class="header-anchor" href="#创建用户" aria-label="Permalink to &quot;创建用户&quot;">​</a></h3><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#F78C6C;">CREATE</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">USER</span><span style="color:#A6ACCD;"> &#39;</span><span style="color:#82AAFF;">renshuo</span><span style="color:#A6ACCD;">&#39;@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> IDENTIFIED </span><span style="color:#F78C6C;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">315217</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span>
<span class="line"><span style="color:#F78C6C;">GRANT</span><span style="color:#A6ACCD;"> all </span><span style="color:#F78C6C;">ON</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;">.</span><span style="color:#89DDFF;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">TO</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">exporter</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">exit</span></span></code></pre></div><h4 id="_6-退出mysql控制台页面-1" tabindex="-1">6 退出MySQL控制台页面 <a class="header-anchor" href="#_6-退出mysql控制台页面-1" aria-label="Permalink to &quot;6 退出MySQL控制台页面&quot;">​</a></h4><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;"># 退出命令</span></span>
<span class="line"><span style="color:#A6ACCD;">exit</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;"># 或者通过快捷键退出：ctrl </span><span style="color:#89DDFF;">+</span><span style="color:#A6ACCD;"> d</span></span></code></pre></div><h4 id="_7-检查端口-1" tabindex="-1">7 检查端口 <a class="header-anchor" href="#_7-检查端口-1" aria-label="Permalink to &quot;7 检查端口&quot;">​</a></h4><p>MySQL默认绑定了3306端口，可以通过端口占用检查MySQL的网络状态</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">netstat</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-anp</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">3306</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062150758.png" alt="image-20221106215020685" style="zoom:80%;"><p>至此，MySQL就安装完成并可用了，请妥善保存好MySQL的root密码。</p><h2 id="mysql卸载" tabindex="-1">MySQL卸载 <a class="header-anchor" href="#mysql卸载" aria-label="Permalink to &quot;MySQL卸载&quot;">​</a></h2><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-qa</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-e</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--nodeps</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql57-community-release-el7-7.noarch</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-community-common-5.7.40-1.el7.x86_64</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211062141208.png" alt="image-20221106214101123" style="zoom:80%;"><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># yum可能处于忙碌，进行如下操作即可</span></span>
<span class="line"><span style="color:#FFCB6B;">rm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-f</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/var/run/yum.pid</span></span></code></pre></div><h2 id="mysql5-7在ubuntu安装" tabindex="-1">MySQL5.7在Ubuntu安装 <a class="header-anchor" href="#mysql5-7在ubuntu安装" aria-label="Permalink to &quot;MySQL5.7在Ubuntu安装&quot;">​</a></h2><blockquote><p>课程中配置的WSL环境是最新的Ubuntu22.04版本，这个版本的软件商店内置的MySQL是8.0版本</p><p>所以我们需要额外的步骤才可以安装5.7版本的MySQL</p></blockquote><p>安装操作需root权限，你可以：</p><p>通过 sudo su -，切换到root用户</p><blockquote><p>课程中选择这种方式操作</p></blockquote><p>或在每一个命令前，加上sudo，用来临时提升权限</p><h3 id="_1-下载和安装-2" tabindex="-1">1 下载和安装 <a class="header-anchor" href="#_1-下载和安装-2" aria-label="Permalink to &quot;1 下载和安装&quot;">​</a></h3><h4 id="_1-下载apt仓库文件" tabindex="-1">1 下载apt仓库文件 <a class="header-anchor" href="#_1-下载apt仓库文件" aria-label="Permalink to &quot;1 下载apt仓库文件&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 下载apt仓库的安装包，Ubuntu的安装包是.deb文件</span></span>
<span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb</span></span></code></pre></div><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094103.png" alt="image-20221016094103315" style="zoom:80%;"><h4 id="_2-配置apt仓库" tabindex="-1">2 配置apt仓库 <a class="header-anchor" href="#_2-配置apt仓库" aria-label="Permalink to &quot;2 配置apt仓库&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 使用dpkg命令安装仓库</span></span>
<span class="line"><span style="color:#FFCB6B;">dpkg</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-i</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-apt-config_0.8.12-1_all.deb</span></span></code></pre></div><p>弹出框中选择：<code>ubuntu bionic</code> （Ubuntu18.04系统的代号是bionic，选择18.04的版本库用来安装）</p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094142.png" alt="image-20221016094142343" style="zoom:80%;"><p>弹出框中选择：<code>MySQL Server &amp; Cluster</code></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094216.png" alt="image-20221016094216377"></p><p>弹出框中选择：<code>mysql-5.7</code></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094254.png" alt="image-20221016094254397"></p><p>最后选择：<code>ok</code></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094306.png" alt="image-20221016094306917"></p><h4 id="_4-更新apt仓库的信息" tabindex="-1">4 更新apt仓库的信息 <a class="header-anchor" href="#_4-更新apt仓库的信息" aria-label="Permalink to &quot;4 更新apt仓库的信息&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 首先导入仓库的密钥信息</span></span>
<span class="line"><span style="color:#FFCB6B;">apt-key</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">adv</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--keyserver</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">keyserver.ubuntu.com</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--recv-keys</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">467</span><span style="color:#C3E88D;">B942D3A79BD29</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 更新仓库信息</span></span>
<span class="line"><span style="color:#FFCB6B;">apt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">update</span></span></code></pre></div><h4 id="_5-检查是否成功配置mysql5-7的仓库" tabindex="-1">5 检查是否成功配置MySQL5.7的仓库 <a class="header-anchor" href="#_5-检查是否成功配置mysql5-7的仓库" aria-label="Permalink to &quot;5 检查是否成功配置MySQL5.7的仓库&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">apt-cache</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">policy</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-server</span></span></code></pre></div><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094546.png" alt="image-20221016094546943"></p><p>看到如图所示字样，即成功</p><h4 id="_6-安装mysql5-7" tabindex="-1">6 安装MySQL5.7 <a class="header-anchor" href="#_6-安装mysql5-7" aria-label="Permalink to &quot;6 安装MySQL5.7&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 使用apt安装mysql客户端和mysql服务端</span></span>
<span class="line"><span style="color:#FFCB6B;">apt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-f</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-client=</span><span style="color:#F78C6C;">5.7</span><span style="color:#A6ACCD;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-community-server=</span><span style="color:#F78C6C;">5.7</span><span style="color:#A6ACCD;">*</span></span></code></pre></div><p>弹出框中输入root密码并选择ok，密码任意，课程中以123456代替</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094941.png" alt="image-20221016094941439"></p><p>再次输入root密码确认</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016094954.png" alt="image-20221016094954505"></p><h3 id="_2-配置mysql" tabindex="-1">2 配置MySQL <a class="header-anchor" href="#_2-配置mysql" aria-label="Permalink to &quot;2 配置MySQL&quot;">​</a></h3><h4 id="_1-启动mysql" tabindex="-1">1 启动MySQL <a class="header-anchor" href="#_1-启动mysql" aria-label="Permalink to &quot;1 启动MySQL&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/etc/init.d/mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;">			</span><span style="color:#676E95;font-style:italic;"># 启动</span></span>
<span class="line"><span style="color:#FFCB6B;">/etc/init.d/mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;">			</span><span style="color:#676E95;font-style:italic;"># 停止</span></span>
<span class="line"><span style="color:#FFCB6B;">/etc/init.d/mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 查看状态</span></span></code></pre></div><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016095259.png" alt="image-20221016095259172"></p><h4 id="_2-对mysql进行初始化" tabindex="-1">2 对MySQL进行初始化 <a class="header-anchor" href="#_2-对mysql进行初始化" aria-label="Permalink to &quot;2 对MySQL进行初始化&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 执行如下命令，此命令是MySQL安装后自带的配置程序</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql_secure_installation</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 可以通过which命令查看到这个自带程序所在的位置</span></span>
<span class="line"><span style="color:#FFCB6B;">root@DESKTOP-Q89USRE:~#</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">which</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql_secure_installation</span></span>
<span class="line"><span style="color:#FFCB6B;">/usr/bin/mysql_secure_installation</span></span></code></pre></div><p>输入密码：</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016095458.png" alt="image-20221016095458755"></p><p>是否开启密码验证插件，如果需要增强密码安全性，输入<code>y</code>并回车，不需要直接回车（课程中选择直接回车）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016095537.png" alt="image-20221016095537716"></p><p>是否更改root密码，需要输入<code>y</code>回车，不需要直接回车（课程不更改）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016095621.png" alt="image-20221016095621386"></p><p>是否移除匿名用户，移除输入<code>y</code>回车，不移除直接回车（课程选择移除）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101232.png" alt="image-20221016101232827"></p><p>是否进制root用户远程登录，禁止输入<code>y</code>回车，不禁止直接回车（课程选择不禁止）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101324.png" alt="image-20221016101324577"></p><p>是否移除自带的测试数据库，移除输入<code>y</code>回车，不移除直接回车（课程选择不移除）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101404.png" alt="image-20221016101404392"></p><p>是否刷新权限，刷新输入<code>y</code>回车，不刷新直接回车（课程选择刷新）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101442.png" alt="image-20221016101442459"></p><h4 id="_4-登陆mysql" tabindex="-1">4 登陆MySQL <a class="header-anchor" href="#_4-登陆mysql" aria-label="Permalink to &quot;4 登陆MySQL&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-uroot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 输入密码即可登陆成功</span></span></code></pre></div><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101524.png" alt="image-20221016101524498"></p><p>至此，在Ubuntu上安装MySQL5.7版本成功。</p><h2 id="mysql8-0-在ubuntu安装" tabindex="-1">MySQL8.0 在Ubuntu安装 <a class="header-anchor" href="#mysql8-0-在ubuntu安装" aria-label="Permalink to &quot;MySQL8.0 在Ubuntu安装&quot;">​</a></h2><blockquote><p>课程中配置的WSL环境是最新的Ubuntu22.04版本，这个版本的软件商店内置的MySQL是8.0版本</p><p>所以直接可以通过apt安装即可</p></blockquote><blockquote><p>注意，课程是以WSL获得的Ubuntu操作系统环境。</p><p>如果你通过VMware虚拟机的方式获得了Ubuntu操作系统环境，操作步骤不用担心，和课程中使用WSL环境是==完全一致的==</p></blockquote><p>安装操作需root权限，你可以：</p><p>通过 sudo su -，切换到root用户</p><blockquote><p>课程中选择这种方式操作</p></blockquote><p>或在每一个命令前，加上sudo，用来临时提升权限</p><h3 id="_1-下载和安装-3" tabindex="-1">1 下载和安装 <a class="header-anchor" href="#_1-下载和安装-3" aria-label="Permalink to &quot;1 下载和安装&quot;">​</a></h3><h4 id="_1-卸载mysql5-7" tabindex="-1">1 卸载MySQL5.7 <a class="header-anchor" href="#_1-卸载mysql5-7" aria-label="Permalink to &quot;1 卸载MySQL5.7&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 卸载MySQL5.7版本</span></span>
<span class="line"><span style="color:#FFCB6B;">apt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">remove</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-client=</span><span style="color:#F78C6C;">5.7</span><span style="color:#A6ACCD;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-community-server=</span><span style="color:#F78C6C;">5.7</span><span style="color:#A6ACCD;">*</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 卸载5.7的仓库信息</span></span>
<span class="line"><span style="color:#FFCB6B;">dpkg</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-l</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">awk</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">{print $2}</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">xargs</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">dpkg</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-P</span></span></code></pre></div><h4 id="_2-更新apt仓库信息" tabindex="-1">2 更新apt仓库信息 <a class="header-anchor" href="#_2-更新apt仓库信息" aria-label="Permalink to &quot;2 更新apt仓库信息&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">apt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">update</span></span></code></pre></div><h4 id="_3-安装mysql" tabindex="-1">3 安装mysql <a class="header-anchor" href="#_3-安装mysql" aria-label="Permalink to &quot;3 安装mysql&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">apt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-server</span></span></code></pre></div><h4 id="_4-启动mysql" tabindex="-1">4 启动MySQL <a class="header-anchor" href="#_4-启动mysql" aria-label="Permalink to &quot;4 启动MySQL&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/etc/init.d/mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;">			</span><span style="color:#676E95;font-style:italic;"># 启动</span></span>
<span class="line"><span style="color:#FFCB6B;">/etc/init.d/mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;">			</span><span style="color:#676E95;font-style:italic;"># 停止</span></span>
<span class="line"><span style="color:#FFCB6B;">/etc/init.d/mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 查看状态</span></span></code></pre></div><h4 id="_5-登陆mysql设置密码" tabindex="-1">5 登陆MySQL设置密码 <a class="header-anchor" href="#_5-登陆mysql设置密码" aria-label="Permalink to &quot;5 登陆MySQL设置密码&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 直接执行：mysql</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql</span></span></code></pre></div><h4 id="_6-设置密码" tabindex="-1">6 设置密码 <a class="header-anchor" href="#_6-设置密码" aria-label="Permalink to &quot;6 设置密码&quot;">​</a></h4><div class="language-sql"><button title="Copy Code" class="copy"></button><span class="lang">sql</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#F78C6C;">ALTER</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">USER</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> IDENTIFIED </span><span style="color:#F78C6C;">WITH</span><span style="color:#A6ACCD;"> mysql_native_password </span><span style="color:#F78C6C;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">password</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">;</span></span></code></pre></div><p>退出MySQL控制台</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">exit</span></span></code></pre></div><h4 id="_7-对mysql进行初始化" tabindex="-1">7 对MySQL进行初始化 <a class="header-anchor" href="#_7-对mysql进行初始化" aria-label="Permalink to &quot;7 对MySQL进行初始化&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 执行如下命令，此命令是MySQL安装后自带的配置程序</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql_secure_installation</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 可以通过which命令查看到这个自带程序所在的位置</span></span>
<span class="line"><span style="color:#FFCB6B;">root@DESKTOP-Q89USRE:~#</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">which</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql_secure_installation</span></span>
<span class="line"><span style="color:#FFCB6B;">/usr/bin/mysql_secure_installation</span></span></code></pre></div><p>输入密码：</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016095458.png" alt="image-20221016095458755"></p><p>是否开启密码验证插件，如果需要增强密码安全性，输入<code>y</code>并回车，不需要直接回车（课程中选择直接回车）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016095537.png" alt="image-20221016095537716"></p><p>是否更改root密码，需要输入<code>y</code>回车，不需要直接回车（课程不更改）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016095621.png" alt="image-20221016095621386"></p><p>是否移除匿名用户，移除输入<code>y</code>回车，不移除直接回车（课程选择移除）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101232.png" alt="image-20221016101232827"></p><p>是否进制root用户远程登录，禁止输入<code>y</code>回车，不禁止直接回车（课程选择不禁止）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101324.png" alt="image-20221016101324577"></p><p>是否移除自带的测试数据库，移除输入<code>y</code>回车，不移除直接回车（课程选择不移除）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101404.png" alt="image-20221016101404392"></p><p>是否刷新权限，刷新输入<code>y</code>回车，不刷新直接回车（课程选择刷新）</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016101442.png" alt="image-20221016101442459"></p><p>重新登陆MySQL（用更改后的密码）</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-uroot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span></span></code></pre></div><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/16/20221016110414.png" alt="image-20221016110414182"></p><p>至此，在Ubuntu上安装MySQL8.0版本成功。</p><h1 id="mysql安装和卸载" tabindex="-1">MySQL安装和卸载 <a class="header-anchor" href="#mysql安装和卸载" aria-label="Permalink to &quot;MySQL安装和卸载&quot;">​</a></h1><h2 id="mysql8-0-26-centos7安装" tabindex="-1">MySQL8.0.26-centos7安装 <a class="header-anchor" href="#mysql8-0-26-centos7安装" aria-label="Permalink to &quot;MySQL8.0.26-centos7安装&quot;">​</a></h2><h3 id="_1-准备一台linux服务器" tabindex="-1">1. 准备一台Linux服务器 <a class="header-anchor" href="#_1-准备一台linux服务器" aria-label="Permalink to &quot;1. 准备一台Linux服务器&quot;">​</a></h3><p>云服务器或者虚拟机都可以; Linux的版本为 CentOS7;</p><h3 id="_2-下载linux版mysql安装包" tabindex="-1">2. 下载Linux版MySQL安装包 <a class="header-anchor" href="#_2-下载linux版mysql安装包" aria-label="Permalink to &quot;2. 下载Linux版MySQL安装包&quot;">​</a></h3><p>文件名：mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar</p><p><a href="https://downloads.mysql.com/archives/community/" target="_blank" rel="noreferrer">https://downloads.mysql.com/archives/community/</a></p><p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20220226182632780.png" alt="image-20220226182632780"></p><p>百度网盘的对应该文件夹也下载了该安装包</p><h3 id="_3-上传mysql安装包" tabindex="-1">3. 上传MySQL安装包 <a class="header-anchor" href="#_3-上传mysql安装包" aria-label="Permalink to &quot;3. 上传MySQL安装包&quot;">​</a></h3><p>用Xshell或者Finalshell都可以，这里用Finalshell</p><p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20211031231930205.png" alt="image-20211031231930205"></p><h3 id="_4-创建目录-并解压" tabindex="-1">4. 创建目录,并解压 <a class="header-anchor" href="#_4-创建目录-并解压" aria-label="Permalink to &quot;4. 创建目录,并解压&quot;">​</a></h3><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">mkdir mysql</span></span>
<span class="line"><span style="color:#A6ACCD;">tar </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">xvf mysql</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">bundle</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">tar </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">C mysql</span></span></code></pre></div><h3 id="_5-安装mysql的安装包" tabindex="-1">5. 安装mysql的安装包 <a class="header-anchor" href="#_5-安装mysql的安装包" aria-label="Permalink to &quot;5. 安装mysql的安装包&quot;">​</a></h3><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">cd mysql</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">e mariadb</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">libs </span><span style="color:#89DDFF;">--</span><span style="color:#A6ACCD;">nodeps</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">ivh mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">common</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm </span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">ivh mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">client</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">plugins</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm </span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">ivh mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">libs</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm </span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">ivh mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">libs</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">compat</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm</span></span>
<span class="line"><span style="color:#A6ACCD;">yum </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">y install openssl</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">devel</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">ivh  mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">devel</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">ivh mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">client</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm </span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">ivh  mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">server</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpm</span></span></code></pre></div><h3 id="_6-启动mysql服务" tabindex="-1">6. 启动MySQL服务 <a class="header-anchor" href="#_6-启动mysql服务" aria-label="Permalink to &quot;6. 启动MySQL服务&quot;">​</a></h3><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">systemctl start mysqld</span></span>
<span class="line"><span style="color:#A6ACCD;">systemctl enable mysqld</span></span></code></pre></div><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">systemctl restart mysqld</span></span></code></pre></div><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">systemctl stop mysqld</span></span></code></pre></div><h3 id="_7-查询自动生成的root用户密码" tabindex="-1">7. 查询自动生成的root用户密码 <a class="header-anchor" href="#_7-查询自动生成的root用户密码" aria-label="Permalink to &quot;7. 查询自动生成的root用户密码&quot;">​</a></h3><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">grep </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">temporary password</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">var</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">log</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">mysqld</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">log</span></span></code></pre></div><p>命令行执行指令 :</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">mysql </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">u root </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">p</span></span></code></pre></div><p><strong>然后输入上述查询到的自动生成的密码</strong>, 完成登录 .</p><h3 id="_8-修改root用户密码" tabindex="-1">8. 修改root用户密码 <a class="header-anchor" href="#_8-修改root用户密码" aria-label="Permalink to &quot;8. 修改root用户密码&quot;">​</a></h3><p>登录到MySQL之后，需要将自动生成的不便记忆的密码修改了，修改成自己熟悉的便于记忆的密码。</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">ALTER  USER  </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">  IDENTIFIED BY </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">315217renS.</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">set global validate_password</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">policy </span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">0</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">set global validate_password</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">length </span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">4</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">ALTER  USER  </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;">  IDENTIFIED BY </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">123456</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span></code></pre></div><p>执行上述的SQL会报错，原因是因为设置的密码太简单，密码复杂度不够。我们可以设置密码的复杂度为简单类型，密码长度为4。降低密码的校验规则之后，再次执行上述修改密码的指令。</p><h3 id="_9-创建用户" tabindex="-1">9. 创建用户 <a class="header-anchor" href="#_9-创建用户" aria-label="Permalink to &quot;9. 创建用户&quot;">​</a></h3><p>默认的root用户只能当前节点localhost访问，是无法远程访问的，我们还需要创建一个root账户，用户远程访问</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">create user </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> IDENTIFIED WITH mysql_native_password BY </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">123456</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span></code></pre></div><h3 id="_10-并给root用户分配权限" tabindex="-1">10. 并给root用户分配权限 <a class="header-anchor" href="#_10-并给root用户分配权限" aria-label="Permalink to &quot;10. 并给root用户分配权限&quot;">​</a></h3><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">grant all on </span><span style="color:#89DDFF;">*.*</span><span style="color:#A6ACCD;"> to </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span></code></pre></div><h3 id="_11-重新连接mysql" tabindex="-1">11. 重新连接MySQL <a class="header-anchor" href="#_11-重新连接mysql" aria-label="Permalink to &quot;11. 重新连接MySQL&quot;">​</a></h3><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">mysql </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">u root </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">p</span></span></code></pre></div><p>然后输入密码</p><p>关闭linux防火墙</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">systemctl stop firewalld</span></span>
<span class="line"><span style="color:#A6ACCD;">systemctl disable firewalld</span></span></code></pre></div><h3 id="_12-通过datagrip远程连接mysql" tabindex="-1">12. 通过DataGrip远程连接MySQL <a class="header-anchor" href="#_12-通过datagrip远程连接mysql" aria-label="Permalink to &quot;12. 通过DataGrip远程连接MySQL&quot;">​</a></h3><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20220206121044280.png" alt="image-20220206121044280" style="zoom:80%;"><h2 id="mysql卸载-linux版" tabindex="-1">MySQL卸载-Linux版 <a class="header-anchor" href="#mysql卸载-linux版" aria-label="Permalink to &quot;MySQL卸载-Linux版&quot;">​</a></h2><p>停止MySQL服务</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">systemctl stop mysqld</span></span></code></pre></div><p>查询MySQL的安装文件</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">qa </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> grep </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">i mysql</span></span></code></pre></div><p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20211031233522877.png" alt="image-20211031233522877"></p><p>卸载上述查询出来的所有的MySQL安装包</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">e mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">client</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">plugins</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64 </span><span style="color:#89DDFF;">--</span><span style="color:#A6ACCD;">nodeps</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">e mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">server</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64 </span><span style="color:#89DDFF;">--</span><span style="color:#A6ACCD;">nodeps</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">e mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">common</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64 </span><span style="color:#89DDFF;">--</span><span style="color:#A6ACCD;">nodeps</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">e mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">libs</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64 </span><span style="color:#89DDFF;">--</span><span style="color:#A6ACCD;">nodeps</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">e mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">client</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64 </span><span style="color:#89DDFF;">--</span><span style="color:#A6ACCD;">nodeps</span></span>
<span class="line"><span style="color:#A6ACCD;">rpm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">e mysql</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">community</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">libs</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">compat</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">8.0.26</span><span style="color:#89DDFF;">-</span><span style="color:#F78C6C;">1.el7</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">x86_64 </span><span style="color:#89DDFF;">--</span><span style="color:#A6ACCD;">nodeps</span></span></code></pre></div><p>删除MySQL的数据存放目录</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">rm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">rf </span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">var</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">lib</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">mysql</span><span style="color:#89DDFF;">/</span></span></code></pre></div><p>删除MySQL的配置文件备份</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">rm </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">rf </span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">etc</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">my</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">cnf</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">rpmsave</span></span></code></pre></div><h2 id="忘记密码" tabindex="-1">忘记密码 <a class="header-anchor" href="#忘记密码" aria-label="Permalink to &quot;忘记密码&quot;">​</a></h2><h3 id="修改-mysql-配置文件" tabindex="-1">修改 MySQL 配置文件 <a class="header-anchor" href="#修改-mysql-配置文件" aria-label="Permalink to &quot;修改 MySQL 配置文件&quot;">​</a></h3><p>首先我们需要打开 MySQL 的配置文件，如果是 Windows 系统的话，MySQL 的配置文件是 my.ini，它在 MySQL 的默认安装目录下；如果是 MacOS 系统的话，配置文件名是 my.cnf，它的路径是 /etc/my.cnf。</p><p>以 MacOS 为例，我们需要<strong>在配置文件的 [mysqld] 后面添加“skip-grant-tables”，意思是设置跳过权限验证</strong>，如下图所示：</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.6.30/202207092156796.png" alt="image-20220709215634706" style="zoom:50%;"><blockquote><p>MacOS 可以直接使用“sudo vim /etc/my.cnf”命令进行配置文件的编辑。</p></blockquote><h4 id="注意事项" tabindex="-1">注意事项 <a class="header-anchor" href="#注意事项" aria-label="Permalink to &quot;注意事项&quot;">​</a></h4><p>在 MacOS 中如果找不到 MySQL 的配置文件，可以直接在 /etc 目录下创建 my.cnf，添加如下内容：</p><blockquote><p>[client]</p><p>default-character-set=utf8</p></blockquote><blockquote><p>[mysqld]</p><p>bind-address = 127.0.0.1</p><p>character-set-server=utf8</p><p>skip-grant-tables</p></blockquote><p>当然如果有其他配置项的话，也可以自行修改。</p><h3 id="重启-mysql" tabindex="-1">重启 MySQL <a class="header-anchor" href="#重启-mysql" aria-label="Permalink to &quot;重启 MySQL&quot;">​</a></h3><p>在修改完配置文件之后，我们需要重启 MySQL 服务才能让配置生效。</p><p>如果是 Windows 系统，我们可以先关闭再启动 MySQL，执行命令如下：</p><blockquote><p>net stop mysql</p><p>net start mysql</p></blockquote><p>如果是 Linux 系统，可以直接使用命令重启：</p><blockquote><p>service mysql restart</p></blockquote><h3 id="设置新密码" tabindex="-1">设置新密码 <a class="header-anchor" href="#设置新密码" aria-label="Permalink to &quot;设置新密码&quot;">​</a></h3><p>重启服务之后我们就可以通过命令行工具来设置 MySQL 的新密码了，首先<strong>我们输入“mysql -u root -p”命令来连接 MySQL 服务器，当出现输入密码框时直接敲回车就可以登录了</strong>，如下图所示：</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.6.30/202207092157477.png" alt="image-20220709215720374" style="zoom:50%;"><p>接下来我们再使用以下命令来设置新的密码：</p><blockquote><p>update user set password=password(&#39;新密码&#39;) where user=&#39;root&#39;; flush privileges; quit</p></blockquote><h3 id="注意事项-1" tabindex="-1">注意事项 <a class="header-anchor" href="#注意事项-1" aria-label="Permalink to &quot;注意事项&quot;">​</a></h3><p>如果在执行该步骤的时候出现 ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement 错误。则需要先执行下 <code>flush privileges</code> 命令，再执行其他命令即可。</p><p>当我们设置完新密码之后，记得要把 MySQL 配置文件中的“skip-grant-tables”（跳过权限验证）去掉，然后再重启 MySQL 的服务就可以正常使用了。</p><h1 id="tomcat-jdk安装【简单】" tabindex="-1">Tomcat | JDK安装【简单】 <a class="header-anchor" href="#tomcat-jdk安装【简单】" aria-label="Permalink to &quot;Tomcat | JDK安装【简单】&quot;">​</a></h1><h2 id="tomcat简介" tabindex="-1">Tomcat简介 <a class="header-anchor" href="#tomcat简介" aria-label="Permalink to &quot;Tomcat简介&quot;">​</a></h2><p>Tomcat 是由 Apache 开发的一个 Servlet 容器，实现了对 Servlet 和 JSP 的支持，并提供了作为Web服务器的一些特有功能，如Tomcat管理和控制平台、安全域管理和Tomcat阀等。简单来说，Tomcat是一个WEB应用程序的托管平台，可以让用户编写的WEB应用程序，被Tomcat所托管，并提供网站服务。</p><blockquote><p>即让用户开发的WEB应用程序，变成可以被访问的网页。</p></blockquote><blockquote><p>本次安装使用Tomcat版本是：10.0.27版本，需要Java（JDK）版本最低为JDK8或更高版本</p><p>课程中使用的JDK版本是：JDK8u351版本</p></blockquote><h2 id="_1-进入官网下载jdk" tabindex="-1">1 进入官网下载JDK <a class="header-anchor" href="#_1-进入官网下载jdk" aria-label="Permalink to &quot;1 进入官网下载JDK&quot;">​</a></h2><p>JDK具体安装步骤如下：</p><p><a href="https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html" target="_blank" rel="noreferrer">https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html</a></p><p><a href="https://www.oracle.com/java/technologies/downloads/archive/" target="_blank" rel="noreferrer">https://www.oracle.com/java/technologies/downloads/archive/</a></p><p><a href="https://www.oracle.com/java/technologies/downloads" target="_blank" rel="noreferrer">https://www.oracle.com/java/technologies/downloads</a></p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211072142307.png" alt="image-20221107214254135" style="zoom:80%;"><p>当前页面往下滑</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211072143811.png" alt="image-20221107214317756" style="zoom:80%;"><p>ctrl+f搜下面名字点击下载，让登录就输入下面的账号密码</p><blockquote><p>Oracle账号密码：1597374863@qq.com 315217renS!</p></blockquote><p>官网查找流程</p><p>进入官网：<a href="https://www.oracle.com/index.html" target="_blank" rel="noreferrer">https://www.oracle.com/index.html</a></p><p>选择“Product”-&gt;“Java” ，选择“Download Java，”选择“Java archive”，网页往下拉，找到对应版本，如Java 8</p><p>进入这个页面，往下拉，找到对应系统的版本，PS：下载历史版本需要Oracle账户</p><p>下载JDK软件，在页面下方找到：</p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/17/20221017163411.png" alt="image-20221017163411651" style="zoom:67%;"><p>下载<code>jdk-8u341-linux-x64.tar.gz</code></p><p>==在弹出的页面中输入Oracle的账户密码即可下载（如无账户，请自行注册，注册是免费的）==</p><h2 id="_2-部署jdk环境⭐" tabindex="-1">2 部署JDK环境⭐ <a class="header-anchor" href="#_2-部署jdk环境⭐" aria-label="Permalink to &quot;2 部署JDK环境⭐&quot;">​</a></h2><p>登陆Linux系统，切换到root用户</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/17/20221017163607.png" alt=""></p><p>通过FinalShell，上传下载好的JDK安装包</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/17/20221017163706.png" alt="image-20221017163706026"></p><p>创建文件夹，用来部署JDK，将JDK和Tomcat都安装部署到：/export/server 内</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">mkdir</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span></code></pre></div><p>解压缩JDK安装文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">jdk-8u341-linux-x64.tar.gz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span></code></pre></div><p>配置JDK的软链接</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/jdk1.8.0_341</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/jdk</span></span></code></pre></div><p>配置JAVA_HOME环境变量，以及将$JAVA_HOME/bin文件夹加入PATH环境变量中</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 编辑/etc/profile文件</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> JAVA_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/jdk</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> PATH</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$PATH</span><span style="color:#C3E88D;">:</span><span style="color:#A6ACCD;">$JAVA_HOME</span><span style="color:#C3E88D;">/bin</span></span></code></pre></div><p>生效环境变量</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">source</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/profile</span></span></code></pre></div><p>配置java执行程序的软链接</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 删除系统自带的java程序</span></span>
<span class="line"><span style="color:#FFCB6B;">rm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-f</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/bin/java</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 软链接我们自己安装的java程序</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/jdk/bin/java</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/bin/java</span></span></code></pre></div><p>判断是否安装成功</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">java</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-version</span></span>
<span class="line"><span style="color:#FFCB6B;">javac</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-version</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211072147465.png" alt="image-20221107214753388" style="zoom:80%;"><h2 id="_3-解压并部署tomcat" tabindex="-1">3 解压并部署Tomcat <a class="header-anchor" href="#_3-解压并部署tomcat" aria-label="Permalink to &quot;3 解压并部署Tomcat&quot;">​</a></h2><blockquote><p>Tomcat建议使用非Root用户安装并启动，可以创建一个用户：tomcat用以部署</p></blockquote><p>首先，放行tomcat需要使用的8080端口的外部访问权限</p><blockquote><p>CentOS系统默认开启了防火墙，阻止外部网络流量访问系统内部</p><p>所以，如果想要Tomcat可以正常使用，需要对Tomcat默认使用的8080端口进行放行</p><p>放行有2种操作方式：</p><ol><li>关闭防火墙</li><li>配置防火墙规则，放行端口</li></ol></blockquote><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 以下操作2选一即可</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 方式1：关闭防火墙</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭防火墙</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 停止防火墙开机自启</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 方式2：放行8080端口的外部访问</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--add-port=8080/tcp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--permanent</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># --add-port=8080/tcp表示放行8080端口的tcp访问，--permanent表示永久生效</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--reload</span><span style="color:#A6ACCD;">								</span><span style="color:#676E95;font-style:italic;"># 重新载入防火墙规则使其生效</span></span></code></pre></div><blockquote><p>方便起见，建议同学们选择方式1，直接关闭防火墙一劳永逸</p><p>防火墙的配置非常复杂，后面会视情况独立出一集防火墙配置规则的章节。</p></blockquote><p>以root用户操作，创建tomcat用户</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 使用root用户操作</span></span>
<span class="line"><span style="color:#FFCB6B;">useradd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">tomcat</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 可选，为tomcat用户配置密码</span></span>
<span class="line"><span style="color:#FFCB6B;">passwd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">tomcat</span></span></code></pre></div><p>下载Tomcat安装包</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 使用root用户操作</span></span>
<span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.27/bin/apache-tomcat-10.0.27.tar.gz</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 如果出现https相关错误，可以使用--no-check-certificate选项</span></span>
<span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--no-check-certificate</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.27/bin/apache-tomcat-10.0.27.tar.gz</span></span></code></pre></div><blockquote><p>如果Linux内下载过慢，可以复制下载链接在Windows系统中使用迅雷等软件加速下载然后上传到Linux内即可</p><p>或者使用课程资料中提供的安装包</p></blockquote><p>解压Tomcat安装包</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 使用root用户操作，否则无权限解压到/export/server内，除非修改此文件夹权限</span></span>
<span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">apache-tomcat-10.0.27.tar.gz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span></code></pre></div><p>创建Tomcat软链接</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 使用root用户操作</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/apache-tomcat-10.0.27</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/tomcat</span></span></code></pre></div><p>修改tomcat安装目录权限</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 使用root用户操作，同时对软链接和tomcat安装文件夹进行修改，使用通配符*进行匹配</span></span>
<span class="line"><span style="color:#FFCB6B;">chown</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-R</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">tomcat:tomcat</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/</span><span style="color:#A6ACCD;">*</span><span style="color:#C3E88D;">tomcat</span><span style="color:#A6ACCD;">*</span></span></code></pre></div><p>切换到tomcat用户</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">su</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">tomcat</span></span></code></pre></div><p>启动tomcat</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/export/server/tomcat/bin/startup.sh</span></span></code></pre></div><p>tomcat启动在8080端口，可以检查是否正常启动成功</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">netstat</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-anp</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">8080</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211072152662.png" alt="image-20221107215237596" style="zoom:80%;"><p>打开浏览器，输入：</p><p>http://centos:8080或<a href="http://192.168.22.146:8080" target="_blank" rel="noreferrer">http://192.168.22.146:8080</a></p><p>使用主机名（需配置好本地的主机名映射）或IP地址访问Tomcat的WEB页面</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211072153816.png" alt="image-20221107215324719" style="zoom:80%;"><p>至此，Tomcat安装配置完成。</p><h1 id="nginx安装部署【简单】" tabindex="-1">Nginx安装部署【简单】 <a class="header-anchor" href="#nginx安装部署【简单】" aria-label="Permalink to &quot;Nginx安装部署【简单】&quot;">​</a></h1><p><em>Nginx</em> (engine x) 是一个高性能的HTTP和反向代理web服务器，同时也提供了IMAP/POP3/SMTP服务。</p><p>同Tomcat一样，Nginx可以托管用户编写的WEB应用程序成为可访问的网页服务，同时也可以作为流量代理服务器，控制流量的中转。Nginx在WEB开发领域，基本上也是必备组件之一了。</p><h2 id="nginx安装方式一" tabindex="-1">Nginx安装方式一 <a class="header-anchor" href="#nginx安装方式一" aria-label="Permalink to &quot;Nginx安装方式一&quot;">​</a></h2><p>Nginx同样需要配置额外的yum仓库，才可以使用yum安装</p><blockquote><p>安装Nginx的操作需要root身份</p></blockquote><p>安装yum依赖程序</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">yum-utils</span></span></code></pre></div><p>手动添加，nginx的yum仓库</p><p>yum程序使用的仓库配置文件，存放在：<code>/etc/yum.repo.d</code>内。</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 创建文件使用vim编辑</span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/yum.repos.d/nginx.repo</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 填入如下内容并保存退出</span></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">nginx-stable</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">stable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">repo</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">http://nginx.org/packages/centos/</span><span style="color:#A6ACCD;">$releasever</span><span style="color:#C3E88D;">/</span><span style="color:#A6ACCD;">$basearch</span><span style="color:#C3E88D;">/</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://nginx.org/keys/nginx_signing.key</span></span>
<span class="line"><span style="color:#A6ACCD;">module_hotfixes</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">true</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">nginx-mainline</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">mainline</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">repo</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">http://nginx.org/packages/mainline/centos/</span><span style="color:#A6ACCD;">$releasever</span><span style="color:#C3E88D;">/</span><span style="color:#A6ACCD;">$basearch</span><span style="color:#C3E88D;">/</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">0</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://nginx.org/keys/nginx_signing.key</span></span>
<span class="line"><span style="color:#A6ACCD;">module_hotfixes</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">true</span></span></code></pre></div><blockquote><p>通过如上操作，我们手动添加了nginx的yum仓库</p></blockquote><p>通过yum安装最新稳定版的nginx</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx</span></span></code></pre></div><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># nginx自动注册了systemctl系统服务</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 启动</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 停止</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 运行状态</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 开机自启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭开机自启</span></span></code></pre></div><p>配置防火墙放行</p><p>nginx默认绑定80端口，需要关闭防火墙或放行80端口</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 方式1（推荐），关闭防火墙</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭开机自启</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 方式2，放行80端口</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--add-port=80/tcp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--permanent</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 放行tcp规则下的80端口，永久生效</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--reload</span><span style="color:#A6ACCD;">							</span><span style="color:#676E95;font-style:italic;"># 重新加载防火墙规则</span></span></code></pre></div><p>启动后浏览器输入Linux服务器的IP地址或主机名即可访问：<a href="http://192.168.22.146" target="_blank" rel="noreferrer">http://192.168.22.146</a></p><blockquote><p>ps：80端口是访问网站的默认端口，所以后面无需跟随端口号</p><p>显示的指定端口也是可以的比如：<a href="http://192.168.22.156:80" target="_blank" rel="noreferrer">http://192.168.22.156:80</a></p></blockquote><p>至此，Nginx安装配置完成。路径：/usr/share/nginx</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211072203979.png" alt="image-20221107220312909" style="zoom:80%;"><h2 id="nginx安装方式二⭐" tabindex="-1">Nginx安装方式二⭐ <a class="header-anchor" href="#nginx安装方式二⭐" aria-label="Permalink to &quot;Nginx安装方式二⭐&quot;">​</a></h2><h3 id="nginx四大阵营" tabindex="-1">Nginx四大阵营 <a class="header-anchor" href="#nginx四大阵营" aria-label="Permalink to &quot;Nginx四大阵营&quot;">​</a></h3><p>开源版是最基础版本，很多模块都是没有的，剩下的都是集成模块的，功能全的</p><p>Nginx开源版：<a href="http://nginx.org/" target="_blank" rel="noreferrer">http://nginx.org/</a></p><p>Nginx plus 商业版：<a href="https://www.nginx.com" target="_blank" rel="noreferrer">https://www.nginx.com</a></p><p>openresty：<a href="http://openresty.org/cn/" target="_blank" rel="noreferrer">http://openresty.org/cn/</a></p><p>Tengine：<a href="http://tengine.taobao.org/" target="_blank" rel="noreferrer">http://tengine.taobao.org/</a></p><h3 id="安装开源版" tabindex="-1">安装开源版 <a class="header-anchor" href="#安装开源版" aria-label="Permalink to &quot;安装开源版&quot;">​</a></h3><h4 id="_1-下载" tabindex="-1">1 下载 <a class="header-anchor" href="#_1-下载" aria-label="Permalink to &quot;1 下载&quot;">​</a></h4><p>进入网站：<a href="http://nginx.org/%EF%BC%9A%E7%82%B9%E5%87%BB%E4%B8%8B%E8%BD%BD" target="_blank" rel="noreferrer">http://nginx.org/：点击下载</a></p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20220407104933859.png" alt="image-20220407104933859" style="zoom:50%;"><h4 id="_2-解压并进入" tabindex="-1">2 解压并进入 <a class="header-anchor" href="#_2-解压并进入" aria-label="Permalink to &quot;2 解压并进入&quot;">​</a></h4><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-xvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx-1.21.6.tar.gz</span></span>
<span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx-1.21.6</span></span></code></pre></div><h4 id="_3-编译安装" tabindex="-1">3 编译安装 <a class="header-anchor" href="#_3-编译安装" aria-label="Permalink to &quot;3 编译安装&quot;">​</a></h4><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># prefix配置安装的路径</span></span>
<span class="line"><span style="color:#FFCB6B;">./configure</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--prefix=/usr/local/nginx</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#FFCB6B;">make</span></span>
<span class="line"><span style="color:#FFCB6B;">make</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span></span></code></pre></div><h4 id="_4-出错依赖" tabindex="-1">4 出错依赖 <a class="header-anchor" href="#_4-出错依赖" aria-label="Permalink to &quot;4 出错依赖&quot;">​</a></h4><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">gcc</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">pcre</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">pcre-devel</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zlib</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zlib-devel</span></span></code></pre></div><h4 id="_5-配置系统变量⭐" tabindex="-1">5 配置系统变量⭐ <a class="header-anchor" href="#_5-配置系统变量⭐" aria-label="Permalink to &quot;5 配置系统变量⭐&quot;">​</a></h4><p>注意：后面的java变量是用冒号分隔开的</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/profile</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 不管前面的PATH是什么，直接在最后写这行就行</span></span>
<span class="line"><span style="color:#A6ACCD;">PATH</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$PATH</span><span style="color:#C3E88D;">:/usr/local/nginx/sbin</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 刷新系统变量</span></span>
<span class="line"><span style="color:#82AAFF;">source</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/profile</span></span></code></pre></div><p>后面就不用切换到sbin目录了，直接nginx开头即可，例如</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-v</span></span></code></pre></div><h3 id="启动nginx" tabindex="-1">启动Nginx <a class="header-anchor" href="#启动nginx" aria-label="Permalink to &quot;启动Nginx&quot;">​</a></h3><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/local/nginx/sbin</span></span>
<span class="line"><span style="color:#FFCB6B;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">启动</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#FFCB6B;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">快速停止</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#FFCB6B;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">quit</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">优雅关闭，在退出前完成已经接受的连接请求</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#FFCB6B;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">reload</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">重新加载配置</span></span></code></pre></div><p>访问：直接输入ip就行</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">http://192.168.22.130/</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20220407105456878.png" alt="image-20220407105456878" style="zoom:50%;"><h3 id="安装成系统服务⭐" tabindex="-1">安装成系统服务⭐ <a class="header-anchor" href="#安装成系统服务⭐" aria-label="Permalink to &quot;安装成系统服务⭐&quot;">​</a></h3><p><strong>创建服务脚本</strong></p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">vi</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/lib/systemd/system/nginx.service</span></span></code></pre></div><p><strong>服务脚本内容</strong></p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">Unit</span><span style="color:#89DDFF;">]</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">Description</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">-</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">web</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">server</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">After</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">network.target</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">remote-fs.target</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nss-lookup.target</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">Service</span><span style="color:#89DDFF;">]</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">Type</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">forking</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">PIDFile</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/usr/local/nginx/logs/nginx.pid</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">ExecStartPre</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/usr/local/nginx/sbin/nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">-t</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-c</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/local/nginx/conf/nginx.conf</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">ExecStart</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/usr/local/nginx/sbin/nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">-c</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/local/nginx/conf/nginx.conf</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">ExecReload</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/usr/local/nginx/sbin/nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">reload</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">ExecStop</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/usr/local/nginx/sbin/nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">ExecQuit</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/usr/local/nginx/sbin/nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">quit</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">PrivateTmp</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">true</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">Install</span><span style="color:#89DDFF;">]</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;">WantedBy</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">multi-user.target</span></span></code></pre></div><p><strong>重新加载系统服务</strong></p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">daemon-reload</span></span></code></pre></div><p><strong>启动服务</strong></p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx.service</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">restart</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx.service</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">reload</span><span style="color:#A6ACCD;">  </span><span style="color:#C3E88D;">nginx.service</span></span></code></pre></div><p><strong>开机启动</strong></p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx.service</span></span></code></pre></div><h2 id="彻底删除nginx" tabindex="-1">彻底删除Nginx <a class="header-anchor" href="#彻底删除nginx" aria-label="Permalink to &quot;彻底删除Nginx&quot;">​</a></h2><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">find</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-name</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nginx</span></span>
<span class="line"><span style="color:#FFCB6B;">rm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-rf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/var/cache/nginx</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/var/log/nginx</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211072214240.png" alt="image-20221107221402153" style="zoom:80%;"><h1 id="rabbitmq安装部署【简单】" tabindex="-1">RabbitMQ安装部署【简单】 <a class="header-anchor" href="#rabbitmq安装部署【简单】" aria-label="Permalink to &quot;RabbitMQ安装部署【简单】&quot;">​</a></h1><p>RabbitMQ一款知名的开源消息队列系统，为企业提供消息的发布、订阅、点对点传输等消息服务。</p><p>RabbitMQ在企业开发中十分常见，课程为大家演示快速搭建RabbitMQ环境。</p><blockquote><p>rabbitmq在yum仓库中的版本比较老，所以我们需要手动构建yum仓库</p></blockquote><h2 id="安装方式一" tabindex="-1">安装方式一 <a class="header-anchor" href="#安装方式一" aria-label="Permalink to &quot;安装方式一&quot;">​</a></h2><p>1 准备yum仓库</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 1. 准备gpgkey密钥</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--import</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--import</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/erlang/gpgkey</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--import</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 2. 准备仓库文件</span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/yum.repos.d/rabbitmq.repo</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 填入如下内容</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">##</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">## Zero dependency Erlang</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">##</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">rabbitmq_erlang</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">rabbitmq_erlang</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/erlang/el/7/</span><span style="color:#A6ACCD;">$basearch</span></span>
<span class="line"><span style="color:#A6ACCD;">repo_gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># PackageCloud&#39;s repository key and RabbitMQ package signing key</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/erlang/gpgkey</span></span>
<span class="line"><span style="color:#A6ACCD;">       </span><span style="color:#FFCB6B;">https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc</span></span>
<span class="line"><span style="color:#A6ACCD;">sslverify</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">sslcacert</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/etc/pki/tls/certs/ca-bundle.crt</span></span>
<span class="line"><span style="color:#A6ACCD;">metadata_expire</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">300</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">rabbitmq_erlang-source</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">rabbitmq_erlang-source</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS</span></span>
<span class="line"><span style="color:#A6ACCD;">repo_gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">0</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># PackageCloud&#39;s repository key and RabbitMQ package signing key</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/erlang/gpgkey</span></span>
<span class="line"><span style="color:#A6ACCD;">       </span><span style="color:#FFCB6B;">https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc</span></span>
<span class="line"><span style="color:#A6ACCD;">sslverify</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">sslcacert</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/etc/pki/tls/certs/ca-bundle.crt</span></span>
<span class="line"><span style="color:#A6ACCD;">metadata_expire</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">300</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">##</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">## RabbitMQ server</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">##</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">rabbitmq_server</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">rabbitmq_server</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/</span><span style="color:#A6ACCD;">$basearch</span></span>
<span class="line"><span style="color:#A6ACCD;">repo_gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">0</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># PackageCloud&#39;s repository key and RabbitMQ package signing key</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey</span></span>
<span class="line"><span style="color:#A6ACCD;">       </span><span style="color:#FFCB6B;">https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc</span></span>
<span class="line"><span style="color:#A6ACCD;">sslverify</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">sslcacert</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/etc/pki/tls/certs/ca-bundle.crt</span></span>
<span class="line"><span style="color:#A6ACCD;">metadata_expire</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">300</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">rabbitmq_server-source</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">rabbitmq_server-source</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS</span></span>
<span class="line"><span style="color:#A6ACCD;">repo_gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">0</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey</span></span>
<span class="line"><span style="color:#A6ACCD;">sslverify</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">sslcacert</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/etc/pki/tls/certs/ca-bundle.crt</span></span>
<span class="line"><span style="color:#A6ACCD;">metadata_expire</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">300</span></span></code></pre></div><p>安装RabbitMQ</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">erlang</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">rabbitmq-server</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span></span></code></pre></div><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">Installed:</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#FFCB6B;">erlang.x86_64</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">0</span><span style="color:#C3E88D;">:23.3.4.11-1.el7</span><span style="color:#A6ACCD;">           </span><span style="color:#C3E88D;">rabbitmq-server.noarch</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">0</span><span style="color:#C3E88D;">:3.10.0-1.el7</span></span></code></pre></div><p>启动</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 使用systemctl管控，服务名：rabbitmq-server</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">rabbitmq-server</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 开机自启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">rabbitmq-server</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭开机自启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">rabbitmq-server</span><span style="color:#A6ACCD;">			</span><span style="color:#676E95;font-style:italic;"># 启动</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">rabbitmq-server</span><span style="color:#A6ACCD;">			</span><span style="color:#676E95;font-style:italic;"># 关闭</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">rabbitmq-server</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 查看状态</span></span></code></pre></div><p>放行防火墙，RabbitMQ使用5672、15672、25672 3个端口</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 方式1（推荐），关闭防火墙</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭开机自启</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 方式2，放行5672 25672端口</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--add-port=5672/tcp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--permanent</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 放行tcp规则下的5672端口，永久生效</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--add-port=15672/tcp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--permanent</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 放行tcp规则下的15672端口，永久生效</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--add-port=25672/tcp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--permanent</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 放行tcp规则下的25672端口，永久生效</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--reload</span><span style="color:#A6ACCD;">								</span><span style="color:#676E95;font-style:italic;"># 重新加载防火墙规则</span></span></code></pre></div><p>启动RabbitMQ的WEB管理控制台</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">rabbitmq-plugins</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">rabbitmq_management</span></span></code></pre></div><p>添加admin用户，并赋予权限</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">rabbitmqctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">add_user</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">admin</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">Itheima66^</span><span style="color:#89DDFF;">&#39;</span></span>
<span class="line"><span style="color:#FFCB6B;">rabbitmqctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">set_permissions</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">/</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">admin</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">.*</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">.*</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">.*</span><span style="color:#89DDFF;">&quot;</span></span>
<span class="line"><span style="color:#FFCB6B;">rabbitmqctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">set_user_tags</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">admin</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">administrator</span></span></code></pre></div><p>浏览器打开管理控制台</p><p><a href="http://192.168.88.130:15672" target="_blank" rel="noreferrer">http://192.168.88.130:15672</a></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/18/20221018154824.png" alt="image-20221018154823983"></p><p>至此，RabbitMQ已经安装完成了。</p><h1 id="redis安装部署【简单】" tabindex="-1">Redis安装部署【简单】 <a class="header-anchor" href="#redis安装部署【简单】" aria-label="Permalink to &quot;Redis安装部署【简单】&quot;">​</a></h1><p>redis是一个开源的、使用C语言编写的、支持网络交互的、可基于内存也可持久化的Key-Value数据库。redis的特点就是：<code>快</code>，可以基于内存存储数据并提供超低延迟、超快的检索速度,一般用于在系统中提供快速缓存的能力。</p><h2 id="redis安装方式一" tabindex="-1">Redis安装方式一 <a class="header-anchor" href="#redis安装方式一" aria-label="Permalink to &quot;Redis安装方式一&quot;">​</a></h2><p>配置<code>EPEL</code>仓库</p><blockquote><p>EPEL 的全称叫 Extra Packages for Enterprise Linux 。EPEL是由 Fedora 社区打造，为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。装上了 EPEL之后，就相当于添加了一个第三方源。EPEL则为服务器版本提供大量的rpm包(yum程序所使用的程序安装包，类似Windows的exe)，而且大多数rpm包在官方 repository 中是找不到的。</p></blockquote><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">epel-release</span></span></code></pre></div><p>安装redis(版本过低：3.2.12)</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211080914574.png" alt="image-20221108091432500" style="zoom:80%;"><p>启动redis</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 使用systemctl管控，服务名：redis</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 开机自启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭开机自启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 启动</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 查看状态</span></span></code></pre></div><p>放行防火墙，redis使用端口6379</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 方式1（推荐），关闭防火墙</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 关闭开机自启</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 方式2，放行6379端口</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--add-port=6379/tcp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--permanent</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 放行tcp规则下的6379端口，永久生效</span></span>
<span class="line"><span style="color:#FFCB6B;">firewall-cmd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--reload</span></span></code></pre></div><p>进入redis服务</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 执行redis-cli</span></span>
<span class="line"><span style="color:#FFCB6B;">redis-cli</span></span>
<span class="line"><span style="color:#82AAFF;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mykey</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hello</span></span>
<span class="line"><span style="color:#FFCB6B;">get</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mykey</span></span></code></pre></div><p>至此，redis安装完成。</p><h2 id="redis安装方式二⭐" tabindex="-1">Redis安装方式二⭐ <a class="header-anchor" href="#redis安装方式二⭐" aria-label="Permalink to &quot;Redis安装方式二⭐&quot;">​</a></h2><h3 id="_1-下载和安装-4" tabindex="-1">1 下载和安装 <a class="header-anchor" href="#_1-下载和安装-4" aria-label="Permalink to &quot;1 下载和安装&quot;">​</a></h3><p>此处选择的Linux版本为CentOS 7，Redis的官方网站地址：<a href="https://redis.io/" target="_blank" rel="noreferrer">https://redis.io/</a></p><p>安装C 语言的编译环境</p><p>Redis是基于C语言编写的，因此首先需要安装Redis所需要的gcc依赖：</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">gcc</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">tcl</span></span>
<span class="line"><span style="color:#FFCB6B;">gcc</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--version</span></span></code></pre></div><p>下载并解压</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-xvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis-6.2.6.tar.gz</span></span>
<span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis-6.2.6</span></span></code></pre></div><p>在redis-6.2.6目录下再次执行make命令（只是编译好）</p><blockquote><p>注意：如果没有准备好C语言编译环境，make 会报错—Jemalloc/jemalloc.h：没有那个文件。解决方案：运行make distclean</p></blockquote><p>在该目录依次执行</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">make</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&amp;&amp;</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">make</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span></span></code></pre></div><h3 id="_2-查看安装目录" tabindex="-1">2 查看安装目录 <a class="header-anchor" href="#_2-查看安装目录" aria-label="Permalink to &quot;2 查看安装目录&quot;">​</a></h3><p>安装完成后，默认安装在/usr/local/bin</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/local/bin</span></span>
<span class="line"><span style="color:#FFCB6B;">ls</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">ls</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/usr/local/bin</span></span></code></pre></div><p>redis-benchmark:性能测试工具，可以在自己本子运行，看看自己本子性能如何,进入/usr/local/bin,执行,即可执行测试</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">./redis-benchmark</span></span></code></pre></div><p>redis-check-aof：修复有问题的AOF文件，rdb和aof后面讲</p><p>redis-check-dump：修复有问题的dump.rdb文件</p><p>redis-sentinel：Redis集群使用</p><p>redis-server：Redis服务器启动命令</p><p>redis-cli：客户端，操作入口</p><h2 id="启动并进入redis" tabindex="-1">启动并进入Redis <a class="header-anchor" href="#启动并进入redis" aria-label="Permalink to &quot;启动并进入Redis&quot;">​</a></h2><h3 id="_1-默认启动" tabindex="-1">1 默认启动 <a class="header-anchor" href="#_1-默认启动" aria-label="Permalink to &quot;1 默认启动&quot;">​</a></h3><p>安装完成后，在任意目录输入redis-server命令即可启动Redis：</p><div class="language-c"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">redis</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">server</span></span></code></pre></div><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20211211081716167.png" alt="image-20211211081716167" style="zoom:50%;"><p>这种启动属于<code>前台启动</code>，会阻塞整个会话窗口，窗口关闭或者按下<code>CTRL + C</code>则Redis停止。不推荐使用</p><h3 id="_2-指定配置文件启动⭐" tabindex="-1">2 指定配置文件启动⭐ <a class="header-anchor" href="#_2-指定配置文件启动⭐" aria-label="Permalink to &quot;2 指定配置文件启动⭐&quot;">​</a></h3><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">redis-server</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/redis.conf</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">redis-cli</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">6379</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">redis-cli</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">shutdown</span></span></code></pre></div><p>如果要让Redis以<code>后台</code>方式启动，则必须修改Redis配置文件(redis.conf)，就在我们之前解压的redis安装包下（<code>/root/redis-6.2.6</code>），名字叫redis.conf：</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img/image-20211211082225509.png" alt="image-20211211082225509" style="zoom:80%;"><p>我们先将这个配置文件备份一份：</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">cp redis</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">conf redis</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">conf</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">bck</span></span></code></pre></div><p>然后修改redis.conf文件中的一些配置：</p><div class="language-properties"><button title="Copy Code" class="copy"></button><span class="lang">properties</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 允许访问的地址，默认是127.0.0.1，会导致只能在本地访问。修改为0.0.0.0则可以在任意IP访问，生产环境不要设置为0.0.0.0</span></span>
<span class="line"><span style="color:#A6ACCD;">bind 0.0.0.0</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 关闭保护模式，不然外界连接不上</span></span>
<span class="line"><span style="color:#A6ACCD;">protected-mode no</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 守护进程，修改为yes后即可后台运行</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 如果是docker启动，就需要设置成no，因为该配置和docker run中-d参数冲突，会导致容器一直启动失败</span></span>
<span class="line"><span style="color:#A6ACCD;">daemonize yes</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 密码，设置后访问Redis必须输入密码</span></span>
<span class="line"><span style="color:#A6ACCD;">requirepass 123321</span></span></code></pre></div><p>Redis的其它常见配置：</p><div class="language-properties"><button title="Copy Code" class="copy"></button><span class="lang">properties</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 监听的端口</span></span>
<span class="line"><span style="color:#A6ACCD;">port 6379</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 工作目录，默认是当前目录，也就是运行redis-server时的命令，日志、持久化等文件会保存在这个目录</span></span>
<span class="line"><span style="color:#A6ACCD;">dir .</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 数据库数量，设置为1，代表只使用1个库，默认有16个库，编号0~15</span></span>
<span class="line"><span style="color:#A6ACCD;">databases 1</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 设置redis能够使用的最大内存</span></span>
<span class="line"><span style="color:#A6ACCD;">maxmemory 512mb</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 日志文件，默认为空，不记录日志，可以指定日志文件名</span></span>
<span class="line"><span style="color:#A6ACCD;">logfile </span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">redis.log</span><span style="color:#89DDFF;">&quot;</span></span></code></pre></div><p>将redis.conf文件拷贝到/etc目录下</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/root/redis-6.2.6</span></span>
<span class="line"><span style="color:#FFCB6B;">cp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis.conf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/redis.conf</span></span></code></pre></div><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">redis-server</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/redis.conf</span></span></code></pre></div><p>使用</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">redis-cli</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">6379</span></span></code></pre></div><p>关闭Redis</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 第一种方式</span></span>
<span class="line"><span style="color:#FFCB6B;">redis-cli</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">shutdown</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 第二种方式(推荐)</span></span>
<span class="line"><span style="color:#FFCB6B;">lsof</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-i:6379</span></span>
<span class="line"><span style="color:#82AAFF;">kill</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-9</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">34558</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">36063</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">125841</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">125841</span></span></code></pre></div><p>停止服务：</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 利用redis-cli来执行 shutdown 命令，即可停止 Redis 服务，</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 因为之前配置了密码，因此需要通过 -u 来指定密码</span></span>
<span class="line"><span style="color:#FFCB6B;">redis-cli</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-u</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">123321</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">shutdown</span></span></code></pre></div><h3 id="_3-注册成系统服务" tabindex="-1">3 注册成系统服务 <a class="header-anchor" href="#_3-注册成系统服务" aria-label="Permalink to &quot;3 注册成系统服务&quot;">​</a></h3><p>我们也可以通过配置来实现开机自启。</p><p>首先，新建一个系统服务文件：</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">vi</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/systemd/system/redis.service</span></span></code></pre></div><p>内容如下：</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">Unit</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">Description</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">redis</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">server</span></span>
<span class="line"><span style="color:#A6ACCD;">After</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">network</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">target</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">Service</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">Type</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">forking</span></span>
<span class="line"><span style="color:#A6ACCD;">ExecStart</span><span style="color:#89DDFF;">=/</span><span style="color:#A6ACCD;">usr</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">local</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">bin</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">redis</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">server </span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">etc</span><span style="color:#89DDFF;">/</span><span style="color:#A6ACCD;">redis</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">conf</span></span>
<span class="line"><span style="color:#A6ACCD;">PrivateTmp</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">true</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">Install</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">WantedBy</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">multi</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">user</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">target</span></span></code></pre></div><p>然后重载系统服务：</p><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">systemctl daemon</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">reload</span></span></code></pre></div><p>现在，我们可以用下面这组命令来操作redis了：</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 启动</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 停止</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 重启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">restart</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 查看状态</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span></span></code></pre></div><p>执行下面的命令，可以让redis开机自启：</p><div class="language-sh"><button title="Copy Code" class="copy"></button><span class="lang">sh</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">redis</span></span></code></pre></div><h3 id="_4-进入redis" tabindex="-1">4 进入Redis <a class="header-anchor" href="#_4-进入redis" aria-label="Permalink to &quot;4 进入Redis&quot;">​</a></h3><div class="language-apl"><button title="Copy Code" class="copy"></button><span class="lang">apl</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">redis</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">cli </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">h </span><span style="color:#F78C6C;">192.168.22.130</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">p </span><span style="color:#F78C6C;">6379</span></span>
<span class="line"><span style="color:#A6ACCD;">redis</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">cli </span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">p </span><span style="color:#F78C6C;">6379</span></span>
<span class="line"><span style="color:#A6ACCD;">redis</span><span style="color:#89DDFF;">-</span><span style="color:#A6ACCD;">cli</span></span></code></pre></div><h1 id="elasticsearch安装部署" tabindex="-1">ElasticSearch安装部署 <a class="header-anchor" href="#elasticsearch安装部署" aria-label="Permalink to &quot;ElasticSearch安装部署&quot;">​</a></h1><p><a href="https://baike.baidu.com/item/%E5%85%A8%E6%96%87%E6%90%9C%E7%B4%A2%E5%BC%95%E6%93%8E" target="_blank" rel="noreferrer">全文搜索</a>属于最常见的需求，开源的 <a href="https://www.elastic.co/" target="_blank" rel="noreferrer">Elasticsearch</a> （以下简称 es）是目前全文搜索引擎的首选。它可以快速地储存、搜索和分析海量数据。维基百科、Stack Overflow、Github 都采用它。Elasticsearch简称es，在企业内同样是一款应用非常广泛的搜索引擎服务。很多服务中的搜索功能，都是基于es来实现的。</p><h2 id="安装方式一-1" tabindex="-1">安装方式一 <a class="header-anchor" href="#安装方式一-1" aria-label="Permalink to &quot;安装方式一&quot;">​</a></h2><h3 id="_1-添加yum仓库" tabindex="-1">1 添加yum仓库 <a class="header-anchor" href="#_1-添加yum仓库" aria-label="Permalink to &quot;1 添加yum仓库&quot;">​</a></h3><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># root执行</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 导入仓库密钥</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--import</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://artifacts.elastic.co/GPG-KEY-elasticsearch</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 添加yum源</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 编辑文件 </span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/yum.repos.d/elasticsearch.repo</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">elasticsearch-7.x</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">Elasticsearch</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">repository</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">for</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">7</span><span style="color:#C3E88D;">.x</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">packages</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://artifacts.elastic.co/packages/7.x/yum</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://artifacts.elastic.co/GPG-KEY-elasticsearch</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">autorefresh</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">type</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">rpm-md</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 更新yum缓存</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">makecache</span></span></code></pre></div><h3 id="_2-安装es" tabindex="-1">2 安装es <a class="header-anchor" href="#_2-安装es" aria-label="Permalink to &quot;2 安装es&quot;">​</a></h3><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">elasticsearch</span></span></code></pre></div><h3 id="_3-配置es" tabindex="-1">3 配置es <a class="header-anchor" href="#_3-配置es" aria-label="Permalink to &quot;3 配置es&quot;">​</a></h3><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/elasticsearch/elasticsearch.yml</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 17行，设置集群名称</span></span>
<span class="line"><span style="color:#FFCB6B;">cluster.name:</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">my-cluster</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 23行，设置节点名称</span></span>
<span class="line"><span style="color:#FFCB6B;">node.name:</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node-1</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 56行，允许外网访问</span></span>
<span class="line"><span style="color:#FFCB6B;">network.host:</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">0.0</span><span style="color:#C3E88D;">.0.0</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 74行，配置集群master节点</span></span>
<span class="line"><span style="color:#FFCB6B;">cluster.initial_master_nodes:</span><span style="color:#A6ACCD;"> [</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">node-1</span><span style="color:#89DDFF;">&quot;</span><span style="color:#A6ACCD;">]</span></span></code></pre></div><h3 id="_4-启动es" tabindex="-1">4 启动es <a class="header-anchor" href="#_4-启动es" aria-label="Permalink to &quot;4 启动es&quot;">​</a></h3><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">|</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">elasticsearch</span></span></code></pre></div><h3 id="_5-关闭防火墙" tabindex="-1">5 关闭防火墙 <a class="header-anchor" href="#_5-关闭防火墙" aria-label="Permalink to &quot;5 关闭防火墙&quot;">​</a></h3><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span></span></code></pre></div><h3 id="_6-访问es测试" tabindex="-1">6 访问ES测试 <a class="header-anchor" href="#_6-访问es测试" aria-label="Permalink to &quot;6 访问ES测试&quot;">​</a></h3><p>浏览器打开：<a href="http://192.168.22.146:9200/?pretty" target="_blank" rel="noreferrer">http://192.168.22.146:9200/?pretty</a></p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211080954956.png" alt="image-20221108095456762" style="zoom:67%;"><h1 id="集群化环境前置准备" tabindex="-1">集群化环境前置准备 <a class="header-anchor" href="#集群化环境前置准备" aria-label="Permalink to &quot;集群化环境前置准备&quot;">​</a></h1><blockquote><p>在前面，我们所学习安装的软件，都是以单机模式运行的。后续，我们将要学习大数据相关的软件部署，所以后续我们所安装的软件服务，大多数都是以集群化（多台服务器共同工作）模式运行的。所以，在当前小节，我们需要完成集群化环境的前置准备，包括创建多台虚拟机，配置主机名映射，SSH免密登录等等。</p></blockquote><h2 id="部署" tabindex="-1">部署 <a class="header-anchor" href="#部署" aria-label="Permalink to &quot;部署&quot;">​</a></h2><h3 id="配置多台linux虚拟机" tabindex="-1">配置多台Linux虚拟机 <a class="header-anchor" href="#配置多台linux虚拟机" aria-label="Permalink to &quot;配置多台Linux虚拟机&quot;">​</a></h3><p>安装集群化软件，首要条件就是要有多台Linux服务器可用。</p><p>我们可以使用VMware提供的克隆功能，将我们的虚拟机额外克隆出3台来使用。</p><ol><li><p>首先，关机当前CentOS系统虚拟机（可以使用root用户执行<code>init 0</code>来快速关机）</p></li><li><p>新建文件夹</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104157.png" alt="image-20221025104157628"></p><p>文件夹起名为：<code>虚拟机集群</code></p></li><li><p>克隆</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104131.png" alt="image-20221025104131303"></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104312.png" alt="image-20221025104312091"></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104329.png" alt="image-20221025104329109"></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104345.png" alt="image-20221025104345484"></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104414.png" alt="image-20221025104414576"></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104427.png" alt="image-20221025104427160"></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104432.png" alt="image-20221025104432927"></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104446.png" alt="image-20221025104446044"></p></li><li><p>同样的操作克隆出：node2和node3</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025104825.png" alt="image-20221025104825204"></p></li><li><p>开启node1，修改主机名为node1，并修改固定ip为：192.168.88.131</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 修改主机名</span></span>
<span class="line"><span style="color:#FFCB6B;">hostnamectl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">set-hostname</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 修改IP地址</span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/sysconfig/network-scripts/ifcfg-ens33</span></span>
<span class="line"><span style="color:#A6ACCD;">IPADDR</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">192.168.88.131</span><span style="color:#89DDFF;">&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 重启网卡</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">network</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">network</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 或者直接</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">restart</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">network</span></span></code></pre></div></li><li><p>同样的操作启动node2和node3,</p><p>修改node2主机名为node2，设置ip为192.168.88.132</p><p>修改node2主机名为node3，设置ip为192.168.88.133</p></li><li><p>配置FinalShell，配置连接到node1、node2、node3的连接</p><blockquote><p>为了简单起见，建议配置root用户登录</p></blockquote></li></ol><h3 id="准备主机名映射" tabindex="-1">准备主机名映射 <a class="header-anchor" href="#准备主机名映射" aria-label="Permalink to &quot;准备主机名映射&quot;">​</a></h3><ol><li><p>在Windows系统中修改hosts文件，填入如下内容：</p><blockquote><p>如果同学们使用MacOS系统，请：</p><ol><li>sudo su -，切换到root</li><li>修改/etc/hosts文件</li></ol></blockquote><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">192.168.88.131</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1</span></span>
<span class="line"><span style="color:#FFCB6B;">192.168.88.132</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2</span></span>
<span class="line"><span style="color:#FFCB6B;">192.168.88.133</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3</span></span></code></pre></div></li><li><p>在3台Linux的/etc/hosts文件中，填入如下内容（==3台都要添加==）</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">192.168.88.131</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1</span></span>
<span class="line"><span style="color:#FFCB6B;">192.168.88.132</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2</span></span>
<span class="line"><span style="color:#FFCB6B;">192.168.88.133</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3</span></span></code></pre></div></li></ol><h3 id="配置ssh免密登录" tabindex="-1">配置SSH免密登录 <a class="header-anchor" href="#配置ssh免密登录" aria-label="Permalink to &quot;配置SSH免密登录&quot;">​</a></h3><h4 id="简介-1" tabindex="-1">简介 <a class="header-anchor" href="#简介-1" aria-label="Permalink to &quot;简介&quot;">​</a></h4><p>SSH服务是一种用于远程登录的安全认证协议。</p><p>我们通过FinalShell远程连接到Linux，就是使用的SSH服务。</p><p>SSH服务支持：</p><ol><li>通过账户+密码的认证方式来做用户认证</li><li>通过账户+秘钥文件的方式做用户认证</li></ol><p>SSH可以让我们通过SSH命令，远程的登陆到其它的主机上，比如：</p><p>在node1执行：ssh root@node2，将以root用户登录node2服务器，输入密码即可成功登陆</p><p>或者ssh node2，将以当前用户直接登陆到node2服务器。</p><h4 id="ssh免密配置" tabindex="-1">SSH免密配置 <a class="header-anchor" href="#ssh免密配置" aria-label="Permalink to &quot;SSH免密配置&quot;">​</a></h4><p>后续安装的集群化软件，多数需要远程登录以及远程执行命令，我们可以简单起见，配置三台Linux服务器之间的免密码互相SSH登陆</p><ol><li><p>在每一台机器都执行：<code>ssh-keygen -t rsa -b 4096</code>，一路回车到底即可</p></li><li><p>在每一台机器都执行：</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">ssh-copy-id</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1</span></span>
<span class="line"><span style="color:#FFCB6B;">ssh-copy-id</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2</span></span>
<span class="line"><span style="color:#FFCB6B;">ssh-copy-id</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3</span></span></code></pre></div></li><li><p>执行完毕后，node1、node2、node3之间将完成root用户之间的免密互通</p></li></ol><h3 id="配置jdk环境" tabindex="-1">配置JDK环境 <a class="header-anchor" href="#配置jdk环境" aria-label="Permalink to &quot;配置JDK环境&quot;">​</a></h3><p>后续的大数据集群软件，多数是需要Java运行环境的，所以我们为==每一台==机器都配置JDK环境。</p><p>JDK配置参阅：<code>Tomcat</code>安装部署环节。</p><h3 id="关闭防火墙和selinux" tabindex="-1">关闭防火墙和SELinux <a class="header-anchor" href="#关闭防火墙和selinux" aria-label="Permalink to &quot;关闭防火墙和SELinux&quot;">​</a></h3><p>集群化软件之间需要通过端口互相通讯，为了避免出现网络不通的问题，我们可以简单的在集群内部关闭防火墙。</p><p>==在每一台机器都执行==</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">stop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">disable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">firewalld</span></span></code></pre></div><p>Linux有一个安全模块：SELinux，用以限制用户和程序的相关权限，来确保系统的安全稳定。</p><p>SELinux的配置同防火墙一样，非常复杂，课程中不多涉及，后续视情况可以出一章SELinux的配置课程。</p><p>在当前，我们只需要关闭SELinux功能，避免导致后面的软件运行出现问题即可，</p><p>==在每一台机器都执行==</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/sysconfig/selinux</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 将第七行，SELINUX=enforcing 改为</span></span>
<span class="line"><span style="color:#A6ACCD;">SELINUX</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">disabled</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 保存退出后，重启虚拟机即可，千万要注意disabled单词不要写错，不然无法启动系统</span></span></code></pre></div><h3 id="添加快照" tabindex="-1">添加快照 <a class="header-anchor" href="#添加快照" aria-label="Permalink to &quot;添加快照&quot;">​</a></h3><p>为了避免后续出现问题，在完成上述设置后，为==每一台虚拟机==都制作快照，留待使用。</p><h2 id="补充命令-scp" tabindex="-1">补充命令 - scp <a class="header-anchor" href="#补充命令-scp" aria-label="Permalink to &quot;补充命令 - scp&quot;">​</a></h2><p>后续的安装部署操作，我们将会频繁的在多台服务器之间相互传输数据。</p><p>为了更加方面的互相传输，我们补充一个命令：scp</p><p>scp命令是cp命令的升级版，即：ssh cp，通过SSH协议完成文件的复制。</p><p>其主要的功能就是：在不同的Linux服务器之间，通过<code>SSH</code>协议互相传输文件。</p><p>只要知晓服务器的账户和密码（或密钥），即可通过SCP互传文件。</p><p>语法：</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> [-r] 参数1 参数2</span></span>
<span class="line"><span style="color:#FFCB6B;">-</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r选项用于复制文件夹使用，如果复制文件夹，必须使用-r</span></span>
<span class="line"><span style="color:#FFCB6B;">-</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">参数1：本机路径</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">或</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">远程目标路径</span></span>
<span class="line"><span style="color:#FFCB6B;">-</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">参数2：远程目标路径</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">或</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">本机路径</span></span>
<span class="line"></span>
<span class="line"><span style="color:#FFCB6B;">如：</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/jdk</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">root@node2:/export/server/</span></span>
<span class="line"><span style="color:#FFCB6B;">将本机上的jdk文件夹，</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">以root的身份复制到node2的/export/server/内</span></span>
<span class="line"><span style="color:#FFCB6B;">同SSH登陆一样，账户名可以省略（使用本机当前的同名账户登陆）</span></span>
<span class="line"></span>
<span class="line"><span style="color:#FFCB6B;">如：</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:/export/server/jdk</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/</span></span>
<span class="line"><span style="color:#FFCB6B;">将远程node2的jdk文件夹，复制到本机的/export/server/内</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># scp命令的高级用法</span></span>
<span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">jdk</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span><span style="color:#A6ACCD;">    </span><span style="color:#676E95;font-style:italic;"># 将本机当前路径的jdk文件夹，复制到node2服务器的同名路径下</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">jdk</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#A6ACCD;">$PWD      </span><span style="color:#676E95;font-style:italic;"># 将本机当前路径的jdk文件夹，复制到node2服务器的同名路径下</span></span></code></pre></div><h1 id="zookeeper集群安装部署" tabindex="-1">Zookeeper集群安装部署 <a class="header-anchor" href="#zookeeper集群安装部署" aria-label="Permalink to &quot;Zookeeper集群安装部署&quot;">​</a></h1><h2 id="简介-2" tabindex="-1">简介 <a class="header-anchor" href="#简介-2" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>ZooKeeper是一个<a href="https://baike.baidu.com/item/%E5%88%86%E5%B8%83%E5%BC%8F/19276232?fromModule=lemma_inlink" target="_blank" rel="noreferrer">分布式</a>的，开放源码的<a href="https://baike.baidu.com/item/%E5%88%86%E5%B8%83%E5%BC%8F%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F/9854429?fromModule=lemma_inlink" target="_blank" rel="noreferrer">分布式应用程序</a>协调服务，是Hadoop和<a href="https://baike.baidu.com/item/Hbase/7670213?fromModule=lemma_inlink" target="_blank" rel="noreferrer">Hbase</a>的重要组件。它是一个为分布式应用提供一致性服务的软件，提供的功能包括：配置维护、域名服务、分布式同步、组服务等。</p><p>除了为Hadoop和HBase提供协调服务外，Zookeeper也被其它许多软件采用作为其分布式状态一致性的依赖，比如Kafka，又或者一些软件项目中，也经常能见到Zookeeper作为一致性协调服务存在。</p><p>Zookeeper不论是大数据领域亦或是其它服务器开发领域，涉及到分布式状态一致性的场景，总有它的身影存在。</p><h2 id="安装" tabindex="-1">安装 <a class="header-anchor" href="#安装" aria-label="Permalink to &quot;安装&quot;">​</a></h2><p>Zookeeper是一款分布式的集群化软件，可以在多台服务器上部署，并协同组成分布式集群一起工作。</p><ol><li><p>首先，要确保已经完成了<code>集群化环境前置准备</code>环节的全部内容</p></li><li><p>【node1上操作】下载Zookeeper安装包，并解压</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 下载</span></span>
<span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">http://archive.apache.org/dist/zookeeper/zookeeper-3.5.9/apache-zookeeper-3.5.9-bin.tar.gz</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 确保如下目录存在，不存在就创建</span></span>
<span class="line"><span style="color:#FFCB6B;">mkdir</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 解压</span></span>
<span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">apache-zookeeper-3.5.9-bin.tar.gz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span></code></pre></div></li><li><p>【node1上操作】创建软链接</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/apache-zookeeper-3.5.9</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper</span></span></code></pre></div></li><li><p>【node1上操作】修改配置文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper/conf/zoo.cfg</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">tickTime</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">2000</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># zookeeper数据存储目录</span></span>
<span class="line"><span style="color:#A6ACCD;">dataDir</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/zookeeper/data</span></span>
<span class="line"><span style="color:#A6ACCD;">clientPort</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">2181</span></span>
<span class="line"><span style="color:#A6ACCD;">initLimit</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">5</span></span>
<span class="line"><span style="color:#A6ACCD;">syncLimit</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">2</span></span>
<span class="line"><span style="color:#FFCB6B;">server.1</span><span style="color:#A6ACCD;">=node1:2888:3888</span></span>
<span class="line"><span style="color:#FFCB6B;">server.2</span><span style="color:#A6ACCD;">=node2:2888:3888</span></span>
<span class="line"><span style="color:#FFCB6B;">server.3</span><span style="color:#A6ACCD;">=node3:2888:3888</span></span></code></pre></div></li><li><p>【node1上操作】配置<code>myid</code></p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 1. 创建Zookeeper的数据目录</span></span>
<span class="line"><span style="color:#FFCB6B;">mkdir</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper/data</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 2. 创建文件，并填入1</span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper/data/myid</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 在文件内填入1即可</span></span></code></pre></div></li><li><p>【在node2和node3上操作】，创建文件夹</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">mkdir</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span></code></pre></div></li><li><p>【node1上操作】将Zookeeper 复制到node2和node3</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span>
<span class="line"></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">apache-zookeeper-3.5.9</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">apache-zookeeper-3.5.9</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span></span></code></pre></div></li><li><p>【在node2上操作】</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 1. 创建软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/apache-zookeeper-3.5.9</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 2. 修改myid文件</span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper/data/myid</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 修改内容为2</span></span></code></pre></div></li><li><p>【在node3上操作】</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 1. 创建软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/apache-zookeeper-3.5.9</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 2. 修改myid文件</span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/zookeeper/data/myid</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 修改内容为3</span></span></code></pre></div></li><li><p>【在node1、node2、node3上分别执行】启动Zookeeper</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 启动命令</span></span>
<span class="line"><span style="color:#FFCB6B;">/export/server/zookeeper/bin/zkServer.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;">		</span><span style="color:#676E95;font-style:italic;"># 启动Zookeeper</span></span></code></pre></div></li><li><p>【在node1、node2、node3上分别执行】检查Zookeeper进程是否启动</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">jps</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 结果中找到有：QuorumPeerMain 进程即可</span></span></code></pre></div></li><li><p>【node1上操作】验证Zookeeper</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/export/server/zookeeper/zkCli.sh</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 进入到Zookeeper控制台中后，执行</span></span>
<span class="line"><span style="color:#FFCB6B;">ls</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 如无报错即配置成功</span></span></code></pre></div></li></ol><p>至此Zookeeper安装完成</p><h1 id="kafka集群安装部署" tabindex="-1">Kafka集群安装部署 <a class="header-anchor" href="#kafka集群安装部署" aria-label="Permalink to &quot;Kafka集群安装部署&quot;">​</a></h1><h2 id="简介-3" tabindex="-1">简介 <a class="header-anchor" href="#简介-3" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>Kafka是一款<code>分布式的、去中心化的、高吞吐低延迟、订阅模式</code>的消息队列系统。</p><p>同RabbitMQ一样，Kafka也是消息队列。不过RabbitMQ多用于后端系统，因其更加专注于消息的延迟和容错。</p><p>Kafka多用于大数据体系，因其更加专注于数据的吞吐能力。</p><p>Kafka多数都是运行在分布式（集群化）模式下，所以课程将以3台服务器，来完成Kafka集群的安装部署。</p><h2 id="安装-1" tabindex="-1">安装 <a class="header-anchor" href="#安装-1" aria-label="Permalink to &quot;安装&quot;">​</a></h2><ol><li><p>确保已经跟随前面的视频，安装并部署了JDK和Zookeeper服务</p><blockquote><p>Kafka的运行依赖JDK环境和Zookeeper请确保已经有了JDK环境和Zookeeper</p></blockquote></li><li><p>【在node1操作】下载并上传Kafka的安装包</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 下载安装包</span></span>
<span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">http://archive.apache.org/dist/kafka/2.4.1/kafka_2.12-2.4.1.tgz</span></span></code></pre></div></li><li><p>【在node1操作】解压</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">mkdir</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span><span style="color:#A6ACCD;">			</span><span style="color:#676E95;font-style:italic;"># 此文件夹如果不存在需先创建</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 解压</span></span>
<span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">kafka_2.12-2.4.1.tgz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 创建软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka_2.12-2.4.1</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka</span></span></code></pre></div></li><li><p>【在node1操作】修改Kafka目录内的config目录内的<code>server.properties</code>文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka/config</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定broker的id</span></span>
<span class="line"><span style="color:#FFCB6B;">broker.id</span><span style="color:#A6ACCD;">=1</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定 kafka的绑定监听的地址</span></span>
<span class="line"><span style="color:#A6ACCD;">listeners</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">PLAINTEXT://node1:9092</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定Kafka数据的位置</span></span>
<span class="line"><span style="color:#FFCB6B;">log.dirs</span><span style="color:#A6ACCD;">=/export/server/kafka/data</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定Zookeeper的三个节点</span></span>
<span class="line"><span style="color:#FFCB6B;">zookeeper.connect</span><span style="color:#A6ACCD;">=node1:2181,node2:2181,node3:2181</span></span></code></pre></div></li><li><p>【在node1操作】将node1的kafka复制到node2和node3</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 复制到node2同名文件夹</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">kafka_2.12-2.4.1</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 复制到node3同名文件夹</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">kafka_2.12-2.4.1</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3:</span><span style="color:#A6ACCD;">$PWD</span></span></code></pre></div></li><li><p>【在node2操作】</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 创建软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka_2.12-2.4.1</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka</span></span>
<span class="line"></span>
<span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka/config</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定broker的id</span></span>
<span class="line"><span style="color:#FFCB6B;">broker.id</span><span style="color:#A6ACCD;">=2</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定 kafka的绑定监听的地址</span></span>
<span class="line"><span style="color:#A6ACCD;">listeners</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">PLAINTEXT://node2:9092</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定Kafka数据的位置</span></span>
<span class="line"><span style="color:#FFCB6B;">log.dirs</span><span style="color:#A6ACCD;">=/export/server/kafka/data</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定Zookeeper的三个节点</span></span>
<span class="line"><span style="color:#FFCB6B;">zookeeper.connect</span><span style="color:#A6ACCD;">=node1:2181,node2:2181,node3:2181</span></span></code></pre></div></li><li><p>【在node3操作】</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 创建软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka_2.12-2.4.1</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka</span></span>
<span class="line"></span>
<span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka/config</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定broker的id</span></span>
<span class="line"><span style="color:#FFCB6B;">broker.id</span><span style="color:#A6ACCD;">=3</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定 kafka的绑定监听的地址</span></span>
<span class="line"><span style="color:#A6ACCD;">listeners</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">PLAINTEXT://node3:9092</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定Kafka数据的位置</span></span>
<span class="line"><span style="color:#FFCB6B;">log.dirs</span><span style="color:#A6ACCD;">=/export/server/kafka/data</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 指定Zookeeper的三个节点</span></span>
<span class="line"><span style="color:#FFCB6B;">zookeeper.connect</span><span style="color:#A6ACCD;">=node1:2181,node2:2181,node3:2181</span></span></code></pre></div></li><li><p>启动kafka</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 请先确保Zookeeper已经启动了</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 方式1：【前台启动】分别在node1、2、3上执行如下语句</span></span>
<span class="line"><span style="color:#FFCB6B;">/export/server/kafka/bin/kafka-server-start.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka/config/server.properties</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 方式2：【后台启动】分别在node1、2、3上执行如下语句</span></span>
<span class="line"><span style="color:#FFCB6B;">nohup</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka/bin/kafka-server-start.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka/config/server.properties</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">2&gt;&amp;1</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&gt;&gt;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/kafka/kafka-server.log</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&amp;</span></span></code></pre></div></li><li><p>验证Kafka启动</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 在每一台服务器执行</span></span>
<span class="line"><span style="color:#FFCB6B;">jps</span></span></code></pre></div><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/25/20221025174522.png" alt="image-20221025174522487"></p></li></ol><h2 id="测试kafka能否正常使用" tabindex="-1">测试Kafka能否正常使用 <a class="header-anchor" href="#测试kafka能否正常使用" aria-label="Permalink to &quot;测试Kafka能否正常使用&quot;">​</a></h2><ol><li>创建测试主题</li></ol><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 在node1执行，创建一个主题</span></span>
<span class="line"><span style="color:#FFCB6B;">/export/server/kafka_2.12-2.4.1/bin/kafka-topics.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--create</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--zookeeper</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1:2181</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--replication-factor</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">1</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--partitions</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">3</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--topic</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">test</span></span></code></pre></div><ol start="2"><li>运行测试，请在FinalShell中打开2个node1的终端页面</li></ol><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 打开一个终端页面，启动一个模拟的数据生产者</span></span>
<span class="line"><span style="color:#FFCB6B;">/export/server/kafka_2.12-2.4.1/bin/kafka-console-producer.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--broker-list</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1:9092</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--topic</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">test</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 再打开一个新的终端页面，在启动一个模拟的数据消费者</span></span>
<span class="line"><span style="color:#FFCB6B;">/export/server/kafka_2.12-2.4.1/bin/kafka-console-consumer.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--bootstrap-server</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1:9092</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--topic</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">test</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--from-beginning</span></span></code></pre></div><h1 id="大数据集群-hadoop生态-安装部署" tabindex="-1">大数据集群（Hadoop生态）安装部署 <a class="header-anchor" href="#大数据集群-hadoop生态-安装部署" aria-label="Permalink to &quot;大数据集群（Hadoop生态）安装部署&quot;">​</a></h1><h2 id="简介-4" tabindex="-1">简介 <a class="header-anchor" href="#简介-4" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>1）Hadoop是一个由Apache基金会所开发的分布式系统基础架构。 2）主要解决，海量数据的存储和海量数据的分析计算问题。</p><p>Hadoop HDFS 提供分布式海量数据存储能力</p><p>Hadoop YARN 提供分布式集群资源管理能力</p><p>Hadoop MapReduce 提供分布式海量数据计算能力</p><h3 id="前置要求-1" tabindex="-1">前置要求 <a class="header-anchor" href="#前置要求-1" aria-label="Permalink to &quot;前置要求&quot;">​</a></h3><ul><li>请确保完成了集群化环境前置准备章节的内容</li><li>即：JDK、SSH免密、关闭防火墙、配置主机名映射等前置操作</li></ul><h3 id="hadoop集群角色" tabindex="-1">Hadoop集群角色 <a class="header-anchor" href="#hadoop集群角色" aria-label="Permalink to &quot;Hadoop集群角色&quot;">​</a></h3><p>Hadoop生态体系中总共会出现如下进程角色：</p><ol><li>Hadoop HDFS的管理角色：Namenode进程（<code>仅需1个即可（管理者一个就够）</code>）</li><li>Hadoop HDFS的工作角色：Datanode进程（<code>需要多个（工人，越多越好，一个机器启动一个）</code>）</li><li>Hadoop YARN的管理角色：ResourceManager进程（<code>仅需1个即可（管理者一个就够）</code>）</li><li>Hadoop YARN的工作角色：NodeManager进程（<code>需要多个（工人，越多越好，一个机器启动一个）</code>）</li><li>Hadoop 历史记录服务器角色：HistoryServer进程（<code>仅需1个即可（功能进程无需太多1个足够）</code>）</li><li>Hadoop 代理服务器角色：WebProxyServer进程（<code>仅需1个即可（功能进程无需太多1个足够）</code>）</li><li>Zookeeper的进程：QuorumPeerMain进程（<code>仅需1个即可（Zookeeper的工作者，越多越好）</code>）</li></ol><h3 id="角色和节点分配" tabindex="-1">角色和节点分配 <a class="header-anchor" href="#角色和节点分配" aria-label="Permalink to &quot;角色和节点分配&quot;">​</a></h3><p>角色分配如下：</p><ol><li>node1:Namenode、Datanode、ResourceManager、NodeManager、HistoryServer、WebProxyServer、QuorumPeerMain</li><li>node2:Datanode、NodeManager、QuorumPeerMain</li><li>node3:Datanode、NodeManager、QuorumPeerMain</li></ol><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026202935.png" alt="image-20221026202935745"></p><h2 id="安装-2" tabindex="-1">安装 <a class="header-anchor" href="#安装-2" aria-label="Permalink to &quot;安装&quot;">​</a></h2><h3 id="调整虚拟机内存" tabindex="-1">调整虚拟机内存 <a class="header-anchor" href="#调整虚拟机内存" aria-label="Permalink to &quot;调整虚拟机内存&quot;">​</a></h3><p>如上图，可以看出node1承载了太多的压力。同时node2和node3也同时运行了不少程序</p><p>为了确保集群的稳定，需要对虚拟机进行内存设置。</p><p>请在VMware中，对：</p><ol><li>node1设置4GB或以上内存</li><li>node2和node3设置2GB或以上内存</li></ol><blockquote><p>大数据的软件本身就是集群化（一堆服务器）一起运行的。</p><p>现在我们在一台电脑中以多台虚拟机来模拟集群，确实会有很大的内存压力哦。</p></blockquote><h3 id="zookeeper集群部署" tabindex="-1">Zookeeper集群部署 <a class="header-anchor" href="#zookeeper集群部署" aria-label="Permalink to &quot;Zookeeper集群部署&quot;">​</a></h3><p>略</p><h3 id="hadoop集群部署" tabindex="-1">Hadoop集群部署 <a class="header-anchor" href="#hadoop集群部署" aria-label="Permalink to &quot;Hadoop集群部署&quot;">​</a></h3><ol><li><p>下载Hadoop安装包、解压、配置软链接</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 1. 下载</span></span>
<span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">http://archive.apache.org/dist/hadoop/common/hadoop-3.3.0/hadoop-3.3.0.tar.gz</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 2. 解压</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 请确保目录/export/server存在</span></span>
<span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hadoop-3.3.0.tar.gz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 3. 构建软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hadoop-3.3.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hadoop</span></span></code></pre></div></li><li><p>修改配置文件：<code>hadoop-env.sh</code></p><blockquote><p>Hadoop的配置文件要修改的地方很多，请细心</p></blockquote><p>cd 进入到/export/server/hadoop/etc/hadoop，文件夹中，配置文件都在这里</p><p>修改hadoop-env.sh文件</p><blockquote><p>此文件是配置一些Hadoop用到的环境变量</p><p>这些是临时变量，在Hadoop运行时有用</p><p>如果要永久生效，需要写到/etc/profile中</p></blockquote><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 在文件开头加入：</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 配置Java安装路径</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> JAVA_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/jdk</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 配置Hadoop安装路径</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/hadoop</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># Hadoop hdfs配置文件路径</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_CONF_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/etc/hadoop</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># Hadoop YARN配置文件路径</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> YARN_CONF_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/etc/hadoop</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># Hadoop YARN 日志文件夹</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> YARN_LOG_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/logs/yarn</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># Hadoop hdfs 日志文件夹</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_LOG_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/logs/hdfs</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># Hadoop的使用启动用户配置</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HDFS_NAMENODE_USER</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">root</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HDFS_DATANODE_USER</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">root</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HDFS_SECONDARYNAMENODE_USER</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">root</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> YARN_RESOURCEMANAGER_USER</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">root</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> YARN_NODEMANAGER_USER</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">root</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> YARN_PROXYSERVER_USER</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">root</span></span></code></pre></div></li><li><p>修改配置文件：<code>core-site.xml</code></p><p>如下，清空文件，填入如下内容</p><div class="language-xml"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">&lt;?</span><span style="color:#F07178;">xml</span><span style="color:#C792EA;"> version</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">1.0</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C792EA;"> encoding</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">UTF-8</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">?&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;?</span><span style="color:#F07178;">xml-stylesheet</span><span style="color:#C792EA;"> type</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">text/xsl</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C792EA;"> href</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">configuration.xsl</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">?&gt;</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!--</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  you may not use this file except in compliance with the License.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  You may obtain a copy of the License at</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">    http://www.apache.org/licenses/LICENSE-2.0</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Unless required by applicable law or agreed to in writing, software</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  See the License for the specific language governing permissions and</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  limitations under the License. See accompanying LICENSE file.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">--&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!-- Put site-specific property overrides in this file. --&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">fs.defaultFS</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">hdfs://node1:8020</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">io.file.buffer.size</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">131072</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span></code></pre></div></li><li><p>配置：<code>hdfs-site.xml</code>文件</p><div class="language-xml"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">&lt;?</span><span style="color:#F07178;">xml</span><span style="color:#C792EA;"> version</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">1.0</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C792EA;"> encoding</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">UTF-8</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">?&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;?</span><span style="color:#F07178;">xml-stylesheet</span><span style="color:#C792EA;"> type</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">text/xsl</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C792EA;"> href</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">configuration.xsl</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">?&gt;</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!--</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  you may not use this file except in compliance with the License.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  You may obtain a copy of the License at</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">    http://www.apache.org/licenses/LICENSE-2.0</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Unless required by applicable law or agreed to in writing, software</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  See the License for the specific language governing permissions and</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  limitations under the License. See accompanying LICENSE file.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">--&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!-- Put site-specific property overrides in this file. --&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">dfs.datanode.data.dir.perm</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">700</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">dfs.namenode.name.dir</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">/data/nn</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">Path on the local filesystem where the NameNode stores the namespace and transactions logs persistently.</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">dfs.namenode.hosts</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">node1,node2,node3</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">List of permitted DataNodes.</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">dfs.blocksize</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">268435456</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">dfs.namenode.handler.count</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">100</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">dfs.datanode.data.dir</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">/data/dn</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span></code></pre></div></li><li><p>配置：<code>mapred-env.sh</code>文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 在文件的开头加入如下环境变量设置</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> JAVA_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/jdk</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_JOB_HISTORYSERVER_HEAPSIZE</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1000</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_MAPRED_ROOT_LOGGER</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">INFO,RFA</span></span></code></pre></div></li><li><p>配置：<code>mapred-site.xml</code>文件</p><div class="language-xml"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">&lt;?</span><span style="color:#F07178;">xml</span><span style="color:#C792EA;"> version</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">1.0</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">?&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;?</span><span style="color:#F07178;">xml-stylesheet</span><span style="color:#C792EA;"> type</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">text/xsl</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C792EA;"> href</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">configuration.xsl</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">?&gt;</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!--</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  you may not use this file except in compliance with the License.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  You may obtain a copy of the License at</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">    http://www.apache.org/licenses/LICENSE-2.0</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Unless required by applicable law or agreed to in writing, software</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  See the License for the specific language governing permissions and</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  limitations under the License. See accompanying LICENSE file.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">--&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!-- Put site-specific property overrides in this file. --&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce.framework.name</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce.jobhistory.address</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">node1:10020</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce.jobhistory.webapp.address</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">node1:19888</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce.jobhistory.intermediate-done-dir</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">/data/mr-history/tmp</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce.jobhistory.done-dir</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">/data/mr-history/done</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.app.mapreduce.am.env</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">HADOOP_MAPRED_HOME=$HADOOP_HOME</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce.map.env</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">HADOOP_MAPRED_HOME=$HADOOP_HOME</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce.reduce.env</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">HADOOP_MAPRED_HOME=$HADOOP_HOME</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span></code></pre></div></li><li><p>配置：<code>yarn-env.sh</code>文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 在文件的开头加入如下环境变量设置</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> JAVA_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/jdk</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/hadoop</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_CONF_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/etc/hadoop</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> YARN_CONF_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/etc/hadoop</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> YARN_LOG_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/logs/yarn</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HADOOP_LOG_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HADOOP_HOME</span><span style="color:#C3E88D;">/logs/hdfs</span></span></code></pre></div></li><li><p>配置：<code>yarn-site.xml</code>文件</p><div class="language-xml"><button title="Copy Code" class="copy"></button><span class="lang">xml</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#89DDFF;">&lt;?</span><span style="color:#F07178;">xml</span><span style="color:#C792EA;"> version</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">1.0</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">?&gt;</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!--</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  you may not use this file except in compliance with the License.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  You may obtain a copy of the License at</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">    http://www.apache.org/licenses/LICENSE-2.0</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  Unless required by applicable law or agreed to in writing, software</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  See the License for the specific language governing permissions and</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">  limitations under the License. See accompanying LICENSE file.</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">--&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!-- Site specific YARN configuration properties --&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.log.server.url</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">http://node1:19888/jobhistory/logs</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.web-proxy.address</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">node1:8089</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">proxy server hostname and port</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.log-aggregation-enable</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">true</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">Configuration to enable or disable log aggregation</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.nodemanager.remote-app-log-dir</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">/tmp/logs</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">Configuration to enable or disable log aggregation</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">&lt;!-- Site specific YARN configuration properties --&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.resourcemanager.hostname</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">node1</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.resourcemanager.scheduler.class</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.nodemanager.local-dirs</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">/data/nm-local</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">Comma-separated list of paths on the local filesystem where intermediate data is written.</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.nodemanager.log-dirs</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">/data/nm-log</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">Comma-separated list of paths on the local filesystem where logs are written.</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.nodemanager.log.retain-seconds</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">10800</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">Default time (in seconds) to retain log files on the NodeManager Only applicable if log-aggregation is disabled.</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">yarn.nodemanager.aux-services</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">mapreduce_shuffle</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">value</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">    </span><span style="color:#89DDFF;">&lt;</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;">Shuffle service that needs to be set for Map Reduce applications.</span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">description</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">  </span><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">property</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;/</span><span style="color:#F07178;">configuration</span><span style="color:#89DDFF;">&gt;</span></span></code></pre></div></li><li><p>修改workers文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 全部内容如下</span></span>
<span class="line"><span style="color:#FFCB6B;">node1</span></span>
<span class="line"><span style="color:#FFCB6B;">node2</span></span>
<span class="line"><span style="color:#FFCB6B;">node3</span></span></code></pre></div></li><li><p>分发hadoop到其它机器</p></li></ol><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 在node1执行</span></span>
<span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span>
<span class="line"></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hadoop-3.3.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hadoop-3.3.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span></span></code></pre></div><ol start="11"><li><p>在node2、node3执行</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 创建软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hadoop-3.3.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hadoop</span></span></code></pre></div></li></ol><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">12. 创建所需目录</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> - 在node1执行：</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">   ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/nn</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/dn</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/nm-log</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/nm-local</span></span>
<span class="line"><span style="color:#A6ACCD;">   ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> - 在node2执行：</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">   ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/dn</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/nm-log</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/nm-local</span></span>
<span class="line"><span style="color:#A6ACCD;">   ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> - 在node3执行：</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">   ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/dn</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/nm-log</span></span>
<span class="line"><span style="color:#A6ACCD;">   mkdir -p /data/nm-local</span></span>
<span class="line"><span style="color:#A6ACCD;">   ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">13. 配置环境变量</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> 在node1、node2、node3修改/etc/profile</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;"> export HADOOP_HOME=/export/server/hadoop</span></span>
<span class="line"><span style="color:#A6ACCD;"> export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin</span></span>
<span class="line"><span style="color:#A6ACCD;"> ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> 执行`source /etc/profile`生效</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">14. 格式化NameNode，在node1执行</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;"> hadoop namenode -format</span></span>
<span class="line"><span style="color:#A6ACCD;"> ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> &gt; hadoop这个命令来自于：$HADOOP_HOME/bin中的程序</span></span>
<span class="line"><span style="color:#A6ACCD;"> &gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> &gt; 由于配置了环境变量PATH，所以可以在任意位置执行hadoop命令哦</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">15. 启动hadoop的hdfs集群，在node1执行即可</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;"> start-dfs.sh</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> # 如需停止可以执行</span></span>
<span class="line"><span style="color:#A6ACCD;"> stop-dfs.sh</span></span>
<span class="line"><span style="color:#A6ACCD;"> ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> &gt; start-dfs.sh这个命令来自于：$HADOOP_HOME/sbin中的程序</span></span>
<span class="line"><span style="color:#A6ACCD;"> &gt;</span></span>
<span class="line"><span style="color:#A6ACCD;"> &gt; 由于配置了环境变量PATH，所以可以在任意位置执行start-dfs.sh命令哦</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">16. 启动hadoop的yarn集群，在node1执行即可</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;"> start-yarn.sh</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> # 如需停止可以执行</span></span>
<span class="line"><span style="color:#A6ACCD;"> stop-yarn.sh</span></span>
<span class="line"><span style="color:#A6ACCD;"> ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">17. 启动历史服务器</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;"> mapred --daemon start historyserver</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> # 如需停止将start更换为stop</span></span>
<span class="line"><span style="color:#A6ACCD;"> ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">18. 启动web代理服务器</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"> ```shell</span></span>
<span class="line"><span style="color:#A6ACCD;"> yarn-daemon.sh start proxyserver</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#A6ACCD;"> # 如需停止将start更换为stop</span></span>
<span class="line"><span style="color:#A6ACCD;"> ```</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">#### 验证Hadoop集群运行情况</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">1. 在node1、node2、node3上通过jps验证进程是否都启动成功</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">2. 验证HDFS，浏览器打开：http://node1:9870</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">创建文件test.txt，随意填入内容，并执行：</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">```shell</span></span>
<span class="line"><span style="color:#A6ACCD;">hadoop fs -put test.txt /test.txt</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">hadoop fs -cat /test.txt</span></span></code></pre></div><ol start="3"><li><p>验证YARN，浏览器打开：<a href="http://node1:8088" target="_blank" rel="noreferrer">http://node1:8088</a></p><p>执行：</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 创建文件words.txt，填入如下内容</span></span>
<span class="line"><span style="color:#FFCB6B;">itheima</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">itcast</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hadoop</span></span>
<span class="line"><span style="color:#FFCB6B;">itheima</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hadoop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hadoop</span></span>
<span class="line"><span style="color:#FFCB6B;">itheima</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">itcast</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 将文件上传到HDFS中</span></span>
<span class="line"><span style="color:#FFCB6B;">hadoop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">fs</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-put</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">words.txt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/words.txt</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 执行如下命令验证YARN是否正常</span></span>
<span class="line"><span style="color:#FFCB6B;">hadoop</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">jar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.3.0.jar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">wordcount</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-Dmapred.job.queue.name=root.root</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/words.txt</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/output</span></span></code></pre></div></li></ol><h1 id="大数据nosql数据库hbase集群部署" tabindex="-1">大数据NoSQL数据库HBase集群部署 <a class="header-anchor" href="#大数据nosql数据库hbase集群部署" aria-label="Permalink to &quot;大数据NoSQL数据库HBase集群部署&quot;">​</a></h1><h2 id="简介-5" tabindex="-1">简介 <a class="header-anchor" href="#简介-5" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>HBase 是一种<a href="https://so.csdn.net/so/search?q=%E5%88%86%E5%B8%83%E5%BC%8F&amp;spm=1001.2101.3001.7020" target="_blank" rel="noreferrer">分布式</a>、可扩展、支持海量数据存储的 NoSQL 数据库。</p><p>和Redis一样，HBase是一款KeyValue型存储的数据库。</p><p>不过和Redis设计方向不同</p><ul><li>Redis设计为少量数据，超快检索</li><li>HBase设计为海量数据，快速检索</li></ul><p>HBase在大数据领域应用十分广泛，现在我们来在node1、node2、node3上部署HBase集群。</p><h2 id="安装-3" tabindex="-1">安装 <a class="header-anchor" href="#安装-3" aria-label="Permalink to &quot;安装&quot;">​</a></h2><ol><li><p>HBase依赖Zookeeper、JDK、Hadoop（HDFS），请确保已经完成前面</p><ul><li>集群化软件前置准备（JDK）</li><li>Zookeeper</li><li>Hadoop</li><li>这些环节的软件安装</li></ul></li><li><p>【node1执行】下载HBase安装包</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 下载</span></span>
<span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">http://archive.apache.org/dist/hbase/2.1.0/hbase-2.1.0-bin.tar.gz</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 解压</span></span>
<span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">hbase-2.1.0-bin.tar.gz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 配置软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hbase-2.1.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hbase</span></span></code></pre></div></li><li><p>【node1执行】，修改配置文件，修改<code>conf/hbase-env.sh</code>文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 在28行配置JAVA_HOME</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> JAVA_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/jdk</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 在126行配置：</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 意思表示，不使用HBase自带的Zookeeper，而是用独立Zookeeper</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HBASE_MANAGES_ZK</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">false</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 在任意行，比如26行，添加如下内容：</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">true</span><span style="color:#89DDFF;">&quot;</span></span></code></pre></div></li><li><p>【node1执行】，修改配置文件，修改<code>conf/hbase-site.xml</code>文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 将文件的全部内容替换成如下内容：</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#A6ACCD;">configuration</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;!</span><span style="color:#FFCB6B;">--</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">HBase数据在HDFS中的存放的路径</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">name&gt;hbase.rootdir&lt;/name&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">value&gt;hdfs://node1:8020/hbase&lt;/value&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">/property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;!</span><span style="color:#FFCB6B;">--</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">Hbase的运行模式。false是单机模式，true是分布式模式。若为false,Hbase和Zookeeper会运行在同一个JVM里面</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">name&gt;hbase.cluster.distributed&lt;/name&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">value&gt;true&lt;/value&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">/property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;!</span><span style="color:#FFCB6B;">--</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">ZooKeeper的地址</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">name&gt;hbase.zookeeper.quorum&lt;/name&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">value&gt;node1,node2,node3&lt;/value&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">/property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;!</span><span style="color:#FFCB6B;">--</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">ZooKeeper快照的存储位置</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">name&gt;hbase.zookeeper.property.dataDir&lt;/name&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">value&gt;/export/server/apache-zookeeper-3.6.0-bin/data&lt;/value&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">/property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;!</span><span style="color:#FFCB6B;">--</span><span style="color:#A6ACCD;">  </span><span style="color:#C3E88D;">V2.1版本，在分布式情况下,</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">设置为false</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">property&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">name&gt;hbase.unsafe.stream.capability.enforce&lt;/name&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">            </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">value&gt;false&lt;/value&gt;</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">&lt;</span><span style="color:#FFCB6B;">/property&gt;</span></span>
<span class="line"><span style="color:#89DDFF;">&lt;</span><span style="color:#A6ACCD;">/configuration</span><span style="color:#89DDFF;">&gt;</span></span></code></pre></div></li><li><p>【node1执行】，修改配置文件，修改<code>conf/regionservers</code>文件</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 填入如下内容</span></span>
<span class="line"><span style="color:#FFCB6B;">node1</span></span>
<span class="line"><span style="color:#FFCB6B;">node2</span></span>
<span class="line"><span style="color:#FFCB6B;">node3</span></span></code></pre></div></li><li><p>【node1执行】，分发hbase到其它机器</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hbase-2.1.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:/export/server/</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hbase-2.1.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3:/export/server/</span></span></code></pre></div></li><li><p>【node2、node3执行】，配置软链接</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hbase-2.1.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/hbase</span></span></code></pre></div></li><li><p>【node1、node2、node3执行】，配置环境变量</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 配置在/etc/profile内，追加如下两行</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> HBASE_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/hbase</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> PATH</span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;">$HBASE_HOME</span><span style="color:#C3E88D;">/bin:</span><span style="color:#A6ACCD;">$PATH</span></span>
<span class="line"></span>
<span class="line"><span style="color:#82AAFF;">source</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/profile</span></span></code></pre></div></li><li><p>【node1执行】启动HBase</p><blockquote><p>请确保：Hadoop HDFS、Zookeeper是已经启动了的</p></blockquote><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">start-hbase.sh</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 如需停止可使用</span></span>
<span class="line"><span style="color:#FFCB6B;">stop-hbase.sh</span></span></code></pre></div><blockquote><p>由于我们配置了环境变量export PATH=$PATH:$HBASE_HOME/bin</p><p>start-hbase.sh即在$HBASE_HOME/bin内，所以可以无论当前目录在哪，均可直接执行</p></blockquote></li><li><p>验证HBase</p><p>浏览器打开：<a href="http://node1:16010" target="_blank" rel="noreferrer">http://node1:16010</a>，即可看到HBase的WEB UI页面</p></li><li><p>简单测试使用HBase</p><p>【node1执行】</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">hbase</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">shell</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 创建表</span></span>
<span class="line"><span style="color:#FFCB6B;">create</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">test</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">cf</span><span style="color:#89DDFF;">&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 插入数据</span></span>
<span class="line"><span style="color:#FFCB6B;">put</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">test</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">rk001</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">cf:info</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">itheima</span><span style="color:#89DDFF;">&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 查询数据</span></span>
<span class="line"><span style="color:#FFCB6B;">get</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">test</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">,</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">rk001</span><span style="color:#89DDFF;">&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 扫描表数据</span></span>
<span class="line"><span style="color:#FFCB6B;">scan</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">test</span><span style="color:#89DDFF;">&#39;</span></span></code></pre></div></li></ol><h1 id="分布式内存计算spark环境部署" tabindex="-1">分布式内存计算Spark环境部署 <a class="header-anchor" href="#分布式内存计算spark环境部署" aria-label="Permalink to &quot;分布式内存计算Spark环境部署&quot;">​</a></h1><h2 id="注意-1" tabindex="-1">注意 <a class="header-anchor" href="#注意-1" aria-label="Permalink to &quot;注意&quot;">​</a></h2><p>本小节的操作，基于：<code>大数据集群（Hadoop生态）安装部署</code>环节中所构建的Hadoop集群</p><p>如果没有Hadoop集群，请参阅前置内容，部署好环境。</p><h2 id="简介-6" tabindex="-1">简介 <a class="header-anchor" href="#简介-6" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>Spark是一款分布式内存计算引擎，可以支撑海量数据的分布式计算。</p><p>Spark在大数据体系是明星产品，作为最新一代的综合计算引擎，支持离线计算和实时计算。</p><p>在大数据领域广泛应用，是目前世界上使用最多的大数据分布式计算引擎。</p><p>我们将基于前面构建的Hadoop集群，部署Spark Standalone集群。</p><h2 id="安装-4" tabindex="-1">安装 <a class="header-anchor" href="#安装-4" aria-label="Permalink to &quot;安装&quot;">​</a></h2><ol><li><p>【node1执行】下载并解压</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://archive.apache.org/dist/spark/spark-2.4.5/spark-2.4.5-bin-hadoop2.7.tgz</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 解压</span></span>
<span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">spark-2.4.5-bin-hadoop2.7.tgz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/spark-2.4.5-bin-hadoop2.7</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/spark</span></span></code></pre></div></li><li><p>【node1执行】修改配置文件名称</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 改名</span></span>
<span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/spark/conf</span></span>
<span class="line"><span style="color:#FFCB6B;">mv</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">spark-env.sh.template</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">spark-env.sh</span></span>
<span class="line"><span style="color:#FFCB6B;">mv</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">slaves.template</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">slaves</span></span></code></pre></div></li><li><p>【node1执行】修改配置文件，<code>spark-env.sh</code></p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;">## 设置JAVA安装目录</span></span>
<span class="line"><span style="color:#A6ACCD;">JAVA_HOME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/jdk</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">## HADOOP软件配置文件目录，读取HDFS上文件和运行YARN集群</span></span>
<span class="line"><span style="color:#A6ACCD;">HADOOP_CONF_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/hadoop/etc/hadoop</span></span>
<span class="line"><span style="color:#A6ACCD;">YARN_CONF_DIR</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/export/server/hadoop/etc/hadoop</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;">## 指定spark老大Master的IP和提交任务的通信端口</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> SPARK_MASTER_HOST</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">node1</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> SPARK_MASTER_PORT</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">7077</span></span>
<span class="line"></span>
<span class="line"><span style="color:#A6ACCD;">SPARK_MASTER_WEBUI_PORT</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">8080</span></span>
<span class="line"><span style="color:#A6ACCD;">SPARK_WORKER_CORES</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">SPARK_WORKER_MEMORY</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span><span style="color:#C3E88D;">g</span></span></code></pre></div></li><li><p>【node1执行】修改配置文件，<code>slaves</code></p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">node1</span></span>
<span class="line"><span style="color:#FFCB6B;">node2</span></span>
<span class="line"><span style="color:#FFCB6B;">node3</span></span></code></pre></div></li><li><p>【node1执行】分发</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">spark-2.4.5-bin-hadoop2.7</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#A6ACCD;">$PWD</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">spark-2.4.5-bin-hadoop2.7</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3:</span><span style="color:#A6ACCD;">$PWD</span></span></code></pre></div></li><li><p>【node2、node3执行】设置软链接</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/spark-2.4.5-bin-hadoop2.7</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/spark</span></span></code></pre></div></li><li><p>【node1执行】启动Spark集群</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/export/server/spark/sbin/start-all.sh</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 如需停止，可以</span></span>
<span class="line"><span style="color:#FFCB6B;">/export/server/spark/sbin/stop-all.sh</span></span></code></pre></div></li><li><p>打开Spark监控页面，浏览器打开：<a href="http://node1:8081" target="_blank" rel="noreferrer">http://node1:8081</a></p></li><li><p>【node1执行】提交测试任务</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/export/server/spark/bin/spark-submit</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--master</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">spark://node1:7077</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">--class</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">org.apache.spark.examples.SparkPi</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/spark/examples/jars/spark-examples_2.11-2.4.5.jar</span></span></code></pre></div></li></ol><h1 id="分布式内存计算flink环境部署" tabindex="-1">分布式内存计算Flink环境部署 <a class="header-anchor" href="#分布式内存计算flink环境部署" aria-label="Permalink to &quot;分布式内存计算Flink环境部署&quot;">​</a></h1><h2 id="注意-2" tabindex="-1">注意 <a class="header-anchor" href="#注意-2" aria-label="Permalink to &quot;注意&quot;">​</a></h2><p>本小节的操作，基于：<code>大数据集群（Hadoop生态）安装部署</code>环节中所构建的Hadoop集群</p><p>如果没有Hadoop集群，请参阅前置内容，部署好环境。</p><h2 id="简介-7" tabindex="-1">简介 <a class="header-anchor" href="#简介-7" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>Flink同Spark一样，是一款分布式内存计算引擎，可以支撑海量数据的分布式计算。</p><p>Flink在大数据体系同样是明星产品，作为最新一代的综合计算引擎，支持离线计算和实时计算。</p><p>在大数据领域广泛应用，是目前世界上除去Spark以外，应用最为广泛的分布式计算引擎。</p><p>我们将基于前面构建的Hadoop集群，部署Flink Standalone集群</p><p>Spark更加偏向于离线计算而Flink更加偏向于实时计算。</p><h2 id="安装-5" tabindex="-1">安装 <a class="header-anchor" href="#安装-5" aria-label="Permalink to &quot;安装&quot;">​</a></h2><ol><li><p>【node1操作】下载安装包</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">wget</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://archive.apache.org/dist/flink/flink-1.10.0/flink-1.10.0-bin-scala_2.11.tgz</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 解压</span></span>
<span class="line"><span style="color:#FFCB6B;">tar</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-zxvf</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">flink-1.10.0-bin-scala_2.11.tgz</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-C</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/flink-1.10.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/flink</span></span></code></pre></div></li><li><p>【node1操作】修改配置文件，<code>conf/flink-conf.yaml</code></p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># jobManager 的IP地址</span></span>
<span class="line"><span style="color:#F07178;">jobmanager.rpc.address</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node1</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># JobManager 的端口号</span></span>
<span class="line"><span style="color:#F07178;">jobmanager.rpc.port</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">6123</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># JobManager JVM heap 内存大小</span></span>
<span class="line"><span style="color:#F07178;">jobmanager.heap.size</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">1024m</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># TaskManager JVM heap 内存大小</span></span>
<span class="line"><span style="color:#F07178;">taskmanager.heap.size</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">1024m</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 每个 TaskManager 提供的任务 slots 数量大小</span></span>
<span class="line"><span style="color:#F07178;">taskmanager.numberOfTaskSlots</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">2</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">#是否进行预分配内存，默认不进行预分配，这样在我们不使用flink集群时候不会占用集群资源</span></span>
<span class="line"><span style="color:#F07178;">taskmanager.memory.preallocate</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#FF9CAC;">false</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 程序默认并行计算的个数</span></span>
<span class="line"><span style="color:#F07178;">parallelism.default</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">#JobManager的Web界面的端口（默认：8081）</span></span>
<span class="line"><span style="color:#F07178;">jobmanager.web.port</span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">8081</span></span></code></pre></div></li><li><p>【node1操作】，修改配置文件，<code>conf/slaves</code></p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">node1</span></span>
<span class="line"><span style="color:#FFCB6B;">node2</span></span>
<span class="line"><span style="color:#FFCB6B;">node3</span></span></code></pre></div></li><li><p>【node1操作】分发Flink安装包到其它机器</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#82AAFF;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">flink-1.10.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node2:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span></span>
<span class="line"><span style="color:#FFCB6B;">scp</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-r</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">flink-1.10.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">node3:</span><span style="color:#89DDFF;">`</span><span style="color:#82AAFF;">pwd</span><span style="color:#89DDFF;">`</span><span style="color:#FFCB6B;">/</span></span></code></pre></div></li><li><p>【node2、node3操作】</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 配置软链接</span></span>
<span class="line"><span style="color:#FFCB6B;">ln</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-s</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/flink-1.10.0</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/flink</span></span></code></pre></div></li><li><p>【node1操作】，启动Flink</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/export/server/flink/bin/start-cluster.sh</span></span></code></pre></div></li><li><p>验证Flink启动</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 浏览器打开</span></span>
<span class="line"><span style="color:#FFCB6B;">http://node1:8081</span></span></code></pre></div></li><li><p>提交测试任务</p><p>【node1执行】</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">/export/server/flink/bin/flink</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">run</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/export/server/flink-1.10.0/examples/batch/WordCount.jar</span></span></code></pre></div></li></ol><h1 id="运维监控zabbix部署" tabindex="-1">运维监控Zabbix部署 <a class="header-anchor" href="#运维监控zabbix部署" aria-label="Permalink to &quot;运维监控Zabbix部署&quot;">​</a></h1><h2 id="简介-8" tabindex="-1">简介 <a class="header-anchor" href="#简介-8" aria-label="Permalink to &quot;简介&quot;">​</a></h2><p>Zabbix 由 Alexei Vladishev 创建，目前由其成立的公司—— Zabbix SIA 积极的持续开发更新维护， 并为用户提供技术支持服务。</p><p>Zabbix 是一个==企业级分布式开源监控解决方案==。</p><p>Zabbix 软件能够==监控==众多网络参数和服务器的==健康度、完整性==。Zabbix 使用灵活的告警机制，允许用户为几乎任何事件配置基于邮件的告警。这样用户可以快速响应服务器问题。Zabbix 基于存储的数据提供出色的报表和数据可视化功能。这些功能使得 Zabbix 成为容量规划的理想选择。</p><h2 id="安装-6" tabindex="-1">安装 <a class="header-anchor" href="#安装-6" aria-label="Permalink to &quot;安装&quot;">​</a></h2><blockquote><p>安装整体步骤:</p></blockquote><ol><li>准备Linux 服务器(虚拟机)</li><li>安装Mysql</li><li>安装zabbix( 包含 server agent web)</li><li>配置 mysql, 为zabbix创建表结构</li><li>配置zabbix server</li><li>启动并开启开机自启动</li></ol><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175324.png" alt="1574338996145"></p><h3 id="安装前准备-mysql" tabindex="-1">安装前准备 - Mysql <a class="header-anchor" href="#安装前准备-mysql" aria-label="Permalink to &quot;安装前准备 - Mysql&quot;">​</a></h3><p>安装ZabbixServer需要先安装好<code>Mysql</code>数据库</p><p>课程使用<code>Mysql 5.7</code></p><p>安装步骤：</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 安装Mysql yum库</span></span>
<span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-Uvh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># yum安装Mysql</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysql-community-server</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 启动Mysql设置开机启动</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 检查Mysql服务状态</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">status</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">mysqld</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 第一次启动mysql，会在日志文件中生成root用户的一个随机密码，使用下面命令查看该密码</span></span>
<span class="line"><span style="color:#FFCB6B;">grep</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">temporary password</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/var/log/mysqld.log</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 修改root用户密码</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-u</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">root</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-p</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-h</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">localhost</span></span>
<span class="line"><span style="color:#FFCB6B;">Enter</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">password:</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span></span>
<span class="line"><span style="color:#FFCB6B;">mysql&gt;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">ALTER</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">USER</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">IDENTIFIED</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">Root!@#$</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 如果你想设置简单密码，需要降低Mysql的密码安全级别</span></span>
<span class="line"><span style="color:#82AAFF;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">global</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">validate_password_policy=LOW</span><span style="color:#89DDFF;">;</span><span style="color:#A6ACCD;"> </span><span style="color:#676E95;font-style:italic;"># 密码安全级别低</span></span>
<span class="line"><span style="color:#82AAFF;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">global</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">validate_password_length=</span><span style="color:#F78C6C;">4</span><span style="color:#89DDFF;">;</span><span style="color:#A6ACCD;">	 </span><span style="color:#676E95;font-style:italic;"># 密码长度最低4位即可</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 然后就可以用简单密码了（课程中使用简单密码，为了方便，生产中不要这样）</span></span>
<span class="line"><span style="color:#FFCB6B;">ALTER</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">USER</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">localhost</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">IDENTIFIED</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">BY</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql&gt;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">grant</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">all</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">privileges</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">on</span><span style="color:#A6ACCD;"> </span><span style="color:#A6ACCD;">*</span><span style="color:#C3E88D;">.</span><span style="color:#A6ACCD;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">to</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">root@</span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">%</span><span style="color:#89DDFF;">&#39;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">identified</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">by</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">root</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span></code></pre></div><h3 id="安装zabbix-server-和-zabbix-agent" tabindex="-1">安装Zabbix Server 和 Zabbix Agent <a class="header-anchor" href="#安装zabbix-server-和-zabbix-agent" aria-label="Permalink to &quot;安装Zabbix Server 和 Zabbix Agent&quot;">​</a></h3><blockquote><p>初始安装，我们先安装ZabbixServer以及在Server本机安装Agent。</p></blockquote><p>打开官网下载页面：<a href="https://www.zabbix.com/download?zabbix=4.0&amp;os_distribution=centos&amp;os_version=7&amp;db=mysql" target="_blank" rel="noreferrer">https://www.zabbix.com/download?zabbix=4.0&amp;os_distribution=centos&amp;os_version=7&amp;db=mysql</a></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175330.png" alt="1571981197131"></p><p>选择对应的版本，然后再下面官网给出了具体的安装命令，使用<code>rpm</code>和<code>yum</code>来进行安装。</p><p>需要有网络。</p><p><code>以下内容来自官方页面</code></p><h4 id="a-安装zabbix-yum库" tabindex="-1">a. 安装Zabbix yum库 <a class="header-anchor" href="#a-安装zabbix-yum库" aria-label="Permalink to &quot;a. 安装Zabbix yum库&quot;">​</a></h4><p><a href="https://www.zabbix.com/documentation/4.0/manual/installation/install_from_packages" target="_blank" rel="noreferrer">documentation</a></p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">rpm</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-Uvh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">clean</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">all</span></span></code></pre></div><h4 id="b-安装zabbix-server、前端、agent" tabindex="-1">b. 安装Zabbix Server、前端、Agent <a class="header-anchor" href="#b-安装zabbix-server、前端、agent" aria-label="Permalink to &quot;b. 安装Zabbix Server、前端、Agent&quot;">​</a></h4><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-server-mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-web-mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-agent</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 如果只需要安装Agent的话</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-y</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-agent</span></span></code></pre></div><h4 id="c-初始化mysql数据库" tabindex="-1">c. 初始化Mysql数据库 <a class="header-anchor" href="#c-初始化mysql数据库" aria-label="Permalink to &quot;c. 初始化Mysql数据库&quot;">​</a></h4><p><a href="https://www.zabbix.com/documentation/4.0/manual/appendix/install/db_scripts" target="_blank" rel="noreferrer">documentation</a></p><blockquote><p>在Mysql中操作</p></blockquote><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 登录Mysql 数据库</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-uroot</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-pYourPassword</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql&gt;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">create</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">database</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">character</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">set</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">utf8</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">collate</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">utf8_bin</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql&gt;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">grant</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">all</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">privileges</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">on</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix.</span><span style="color:#A6ACCD;">*</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">to</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix@localhost</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">identified</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">by</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&#39;</span><span style="color:#C3E88D;">zabbix</span><span style="color:#89DDFF;">&#39;</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 或者: grant all privileges on zabbix.* to zabbix@&#39;%&#39; identified by &#39;zabbix&#39;;</span></span>
<span class="line"><span style="color:#FFCB6B;">mysql&gt;</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">quit</span><span style="color:#89DDFF;">;</span></span></code></pre></div><p>测试在Zabbix Server服务器上能否远程登录Mysql，如果可以登录继续向下走。</p><p>Import initial schema and data. You will be prompted to enter your newly created password.</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix</span></span></code></pre></div><h4 id="d-为zabbix-server配置数据库" tabindex="-1">d. 为Zabbix Server配置数据库 <a class="header-anchor" href="#d-为zabbix-server配置数据库" aria-label="Permalink to &quot;d. 为Zabbix Server配置数据库&quot;">​</a></h4><p>Edit file /etc/zabbix/zabbix_server.conf</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">DBPassword</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">password</span></span>
<span class="line"><span style="color:#A6ACCD;">DBHost</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">mysql-host-ip-or-hostname</span></span></code></pre></div><h4 id="e-配置zabbix的php前端" tabindex="-1">e. 配置Zabbix的PHP前端 <a class="header-anchor" href="#e-配置zabbix的php前端" aria-label="Permalink to &quot;e. 配置Zabbix的PHP前端&quot;">​</a></h4><p>Edit file <code>/etc/httpd/conf.d/zabbix.conf</code>, uncomment and set the right timezone for you.<code># php_value date.timezone Asia/Shanghai</code></p><p>Start Zabbix server and agent processes and make it start at system boot:</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">restart</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-server</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-agent</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">httpd</span><span style="color:#A6ACCD;"> </span><span style="color:#676E95;font-style:italic;"># 启动、重启</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-server</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">zabbix-agent</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">httpd</span><span style="color:#A6ACCD;">  </span><span style="color:#676E95;font-style:italic;"># 开机自启</span></span></code></pre></div><p>Now your Zabbix server is up and running!</p><h3 id="配置zabbix-前端-web-ui" tabindex="-1">配置zabbix 前端（WEB UI） <a class="header-anchor" href="#配置zabbix-前端-web-ui" aria-label="Permalink to &quot;配置zabbix 前端（WEB UI）&quot;">​</a></h3><p><strong>打开:<code>http://192.168.88.131/zabbix</code></strong></p><p>即可进入Zabbix页面，在首次打开的时候，会进入设置页面，如图：</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175338.png" alt="1571993951841"></p><p><strong>点击下一步，会检查相应的设置是否都正常</strong></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175341.png" alt="1571994018126"></p><p>如果一切正常，点击下一步。</p><p><strong>配置DB连接</strong></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175344.png" alt="1571994069689"></p><p>按具体情况填写即可</p><p><strong>配置Server细节</strong></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175347.png" alt="1571994111921"></p><p>具体配置即可，Name表示这个Zabbix服务的名字，这里起名叫<code>ITHEIMA-TEST</code></p><p><strong>安装前总结预览</strong></p><p>检查确认没有问题就下一步</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175349.png" alt="1571994206902"></p><p><strong>配置完成</strong></p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175351.png" alt="1571994221531"></p><p><strong>初始管理员账户Admin密码zabbix</strong></p><p>输入账户密码后，就能进入zabbix页面了。</p><p>如下图：</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175354.png" alt="1571994287036"></p><p>现在是一个崭新的zabbix等待我们去探索。</p><h1 id="运维监控grafana部署" tabindex="-1">运维监控Grafana部署 <a class="header-anchor" href="#运维监控grafana部署" aria-label="Permalink to &quot;运维监控Grafana部署&quot;">​</a></h1><h2 id="简介-9" tabindex="-1">简介 <a class="header-anchor" href="#简介-9" aria-label="Permalink to &quot;简介&quot;">​</a></h2><h2 id="安装-7" tabindex="-1">安装 <a class="header-anchor" href="#安装-7" aria-label="Permalink to &quot;安装&quot;">​</a></h2><h3 id="部署形式" tabindex="-1">部署形式 <a class="header-anchor" href="#部署形式" aria-label="Permalink to &quot;部署形式&quot;">​</a></h3><p><code>Grafana</code>支持两种部署形式</p><ol><li>自行部署, 可以部署在操作系统之上. 自行提供服务器, 域名等.</li><li><code>Grafana</code>官方托管. 无需安装, 在线注册即可得到一个专属于自己的<code>Grafana</code>, 但是要花钱的. 是一种<code>SaaS</code>服务</li></ol><p>我们课程选择方式1</p><h3 id="安装-8" tabindex="-1">安装 <a class="header-anchor" href="#安装-8" aria-label="Permalink to &quot;安装&quot;">​</a></h3><p><code>Grafana</code>支持常见的绝大多数操作系统, 如<code>windows</code> <code>mac</code> <code>linux</code> 同时也支持部署在<code>docker</code>中.</p><p>大多数情况下, <code>Grafana</code>都是部署在<code>linux</code>服务器之上. 所以本课程也是基于<code>Linux</code>系统来讲解.</p><p>对<code>windows</code> <code>mac</code>系统 或 <code>docker</code>部署有兴趣的同学, 请参考: <a href="https://grafana.com/grafana/download" target="_blank" rel="noreferrer">https://grafana.com/grafana/download</a></p><p>我们部署<code>Grafana</code>可以使用<code>YUM</code>来进行部署.</p><div class="language-shell"><button title="Copy Code" class="copy"></button><span class="lang">shell</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># 创建一个文件</span></span>
<span class="line"><span style="color:#FFCB6B;">vim</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">/etc/yum.repos.d/grafana.repo</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 将下面的内容复制进去</span></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">grafana</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#A6ACCD;">name</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">grafana</span></span>
<span class="line"><span style="color:#A6ACCD;">baseurl</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packages.grafana.com/oss/rpm</span></span>
<span class="line"><span style="color:#A6ACCD;">repo_gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">enabled</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgcheck</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">gpgkey</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">https://packages.grafana.com/gpg.key</span></span>
<span class="line"><span style="color:#A6ACCD;">sslverify</span><span style="color:#89DDFF;">=</span><span style="color:#F78C6C;">1</span></span>
<span class="line"><span style="color:#A6ACCD;">sslcacert</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">/etc/pki/tls/certs/ca-bundle.crt</span></span>
<span class="line"></span>
<span class="line"><span style="color:#676E95;font-style:italic;"># 最后安装</span></span>
<span class="line"><span style="color:#FFCB6B;">yum</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">install</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">grafana</span></span></code></pre></div><h3 id="配置说明" tabindex="-1">配置说明 <a class="header-anchor" href="#配置说明" aria-label="Permalink to &quot;配置说明&quot;">​</a></h3><p><code>grafana-server</code>具有许多配置选项，这些选项可以在<code>.ini</code>配置文件中指定，也可以使用环境变量指定。</p><blockquote><p><strong>Note.</strong> <code>Grafana </code> needs to be restarted for any configuration changes to take effect.</p></blockquote><h4 id="配置文件注释" tabindex="-1">配置文件注释 <a class="header-anchor" href="#配置文件注释" aria-label="Permalink to &quot;配置文件注释&quot;">​</a></h4><p><code>;</code>符号在<code>.ini</code>文件中全局表示注释 ()</p><h4 id="配置文件路径" tabindex="-1">配置文件路径 <a class="header-anchor" href="#配置文件路径" aria-label="Permalink to &quot;配置文件路径&quot;">​</a></h4><p>如果是自己解压安装, 或者自行编译的方式安装, 配置文件在:</p><ul><li>默认: <code>$WORKING_DIR/conf/defaults.ini</code></li><li>自定义:<code>$WORKING_DIR/conf/custom.ini</code></li><li>自定义配置文件路径可以被参数<code>--config</code>覆盖</li></ul><blockquote><p>对于<code>YUM</code> <code>RPM</code> 安装的方式, 配置文件在: <code>/etc/grafana/grafana.ini</code></p></blockquote><h4 id="使用环境变量" tabindex="-1">使用环境变量 <a class="header-anchor" href="#使用环境变量" aria-label="Permalink to &quot;使用环境变量&quot;">​</a></h4><p>可以使用以下语法使用环境变量来覆盖配置文件中的所有选项：</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">GF_&lt;SectionName&gt;_&lt;KeyName&gt;</span></span></code></pre></div><p>其中<code>SectionName</code>是方括号内的文本。一切都应为大写，<code>.</code>应替换为<code>_</code> 例如，给定以下配置设置：</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;"># default section</span></span>
<span class="line"><span style="color:#FFCB6B;">instance_name</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">${</span><span style="color:#A6ACCD;">HOSTNAME</span><span style="color:#89DDFF;">}</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">security</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#FFCB6B;">admin_user</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">admin</span></span>
<span class="line"></span>
<span class="line"><span style="color:#89DDFF;">[</span><span style="color:#A6ACCD;">auth.google</span><span style="color:#89DDFF;">]</span></span>
<span class="line"><span style="color:#FFCB6B;">client_secret</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#F78C6C;">0</span><span style="color:#C3E88D;">ldS3cretKey</span></span></code></pre></div><p>Then you can override them using:</p><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> GF_DEFAULT_INSTANCE_NAME</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">my-instance</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> GF_SECURITY_ADMIN_USER</span><span style="color:#89DDFF;">=</span><span style="color:#89DDFF;">true</span><span style="color:#A6ACCD;">	</span><span style="color:#676E95;font-style:italic;"># GF_ 固定 SECURITY 是SectionName ADMIN_USER 是配置的key 转大写 . 转 _</span></span>
<span class="line"><span style="color:#C792EA;">export</span><span style="color:#A6ACCD;"> GF_AUTH_GOOGLE_CLIENT_SECRET</span><span style="color:#89DDFF;">=</span><span style="color:#C3E88D;">newS3cretKey</span></span></code></pre></div><h3 id="开始配置" tabindex="-1">开始配置 <a class="header-anchor" href="#开始配置" aria-label="Permalink to &quot;开始配置&quot;">​</a></h3><p><code>Grafana</code>支持使用<code>Sqlite3</code> <code>Postgresql</code> <code>Mysql</code>这三种数据库作为其<code>元数据</code>的存储.</p><p>我们课程使用<code>Mysql</code>. 和<code>zabbix</code>的元数据mysql共用一个实例</p><p>只需要配置如下内容即可:</p><p><img src="https://image-set.oss-cn-zhangjiakou.aliyuncs.com/img-out/2022/10/26/20221026175713.png" alt="1573635500521"></p><p>并登陆mysql, 执行:</p><p><code>create database grafana CHARACTER SET utf8 COLLATE utf8_general_ci;</code></p><p>创建<code>Grafana</code>使用的数据库作为元数据存储.</p><h3 id="启动" tabindex="-1">启动 <a class="header-anchor" href="#启动" aria-label="Permalink to &quot;启动&quot;">​</a></h3><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">daemon-reload</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">start</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">grafana-server</span></span>
<span class="line"><span style="color:#FFCB6B;">systemctl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">enable</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">grafana-server</span></span></code></pre></div><p>浏览器打开：<a href="http://node1:3000" target="_blank" rel="noreferrer">http://node1:3000</a></p><p>默认账户密码：admin/admin</p><h1 id="网站部署的完整流程" tabindex="-1">网站部署的完整流程 <a class="header-anchor" href="#网站部署的完整流程" aria-label="Permalink to &quot;网站部署的完整流程&quot;">​</a></h1><p>有很多做网页的前端后端小白都想把自己辛辛苦苦做出来的网站放到网上，让别人观摩观摩。可无奈技术有限，对于网站部署流程有些迷茫。在这里，我会告诉大家，如何将自己做出来的网站放到网上。</p><p>首先，我们需要明白几个概念：备案，解析。</p><p>然后，我们还要知道，应该准备什么东西：网站源代码（这个就不细说了），服务器，域名。</p><h2 id="备案" tabindex="-1">备案 <a class="header-anchor" href="#备案" aria-label="Permalink to &quot;备案&quot;">​</a></h2><p>所谓的网站备案其实是网站的ICP备案的简称，国家相关规定如下：《互联网信息服务管理办法》指出互联网信息服务分为经营性和非经营性两类。国家对经营性互联网信息服务实行许可制度；对非经营性互联网信息服务实行备案制度。未取得许可或者未履行备案手续的，不得从事互联网信息服务。</p><p>一般来说，备案指的是域名进行备案，而不是服务器进行备案。一个网站是否备案，是取决于网站所用空间是国内还是国外的. 如果是国内主机，网站域名需要备案，才能通过域名访问到你的网站。</p><p>如果是国外主机，网站域名是不用备案的，也可以通过域名访问。</p><h2 id="解析" tabindex="-1">解析 <a class="header-anchor" href="#解析" aria-label="Permalink to &quot;解析&quot;">​</a></h2><p>域名解析是把域名指向网站空间IP，让人们通过注册的域名可以方便地访问到网站的一种服务。IP地址是网络上标识站点的数字地址，为了方便记忆，采用域名来代替IP地址标识站点地址。域名解析就是域名到IP地址的转换过程。域名的解析工作由DNS服务器完成。了解完这些之后，我们可以进行实际操作。</p><h2 id="服务器" tabindex="-1">服务器 <a class="header-anchor" href="#服务器" aria-label="Permalink to &quot;服务器&quot;">​</a></h2><p>服务器是提供计算服务器、网络服务的一种设备。当我们访问一个网站时，点击这个网站会发出访问请求，服务器会响应服务请求，并相对应地进行处理，反馈相对应的数据。</p><p>如果我们想要把自己的网站让别人也能看到，那就必须要放到服务器上。而比较常见的分为个人服务器，企业级服务器。一般我们需要的是个人服务器。现在人们用的比较多的服务器有：阿里云，腾讯云，百度云等。在这里我以阿里云为例进行讲解（其他几款流程也大致相同）。</p><h3 id="_1-阿里云官网购买服务器" tabindex="-1">1 阿里云官网购买服务器 <a class="header-anchor" href="#_1-阿里云官网购买服务器" aria-label="Permalink to &quot;1 阿里云官网购买服务器&quot;">​</a></h3><p>注册什么的有支付宝一般没什么问题，略过</p><p>对于小白来说，个人服务器一般有两种选择，一种是云服务器 ECS ，一种是轻量应用服务器。</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211141139574.png" alt="image-20221114113921475" style="zoom:80%;"><h4 id="ecs云服务器" tabindex="-1">ECS云服务器 <a class="header-anchor" href="#ecs云服务器" aria-label="Permalink to &quot;ECS云服务器&quot;">​</a></h4><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211141139243.png" alt="image-20221114113934160" style="zoom:67%;"><h4 id="轻量应用服务器" tabindex="-1">轻量应用服务器 <a class="header-anchor" href="#轻量应用服务器" aria-label="Permalink to &quot;轻量应用服务器&quot;">​</a></h4><p>两者区别不大，前者类似于纯净版系统，需要有一定的运维技术，配置起来较为繁琐；后者类似于基础版系统，易用易上手。在性能上，后者将系统盘升级为SSD，容量减小一半，提升了性能。相同CPU，在内存相同的情况下，单来比较磁盘读写性能,可见速度的提升明显。</p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgndgvKckf0ibk2ffiaMiaV47ejWwqDAq6m0PBTOREoonj2XDNH3wqKhC4cg/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片" style="zoom:67%;"><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnR3DNnRiaHyic9B8NLZyMBmmj1nuOaaObRfCibh9HO9nibJ1moXfzCibyXIg/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><h4 id="购买界面" tabindex="-1">购买界面 <a class="header-anchor" href="#购买界面" aria-label="Permalink to &quot;购买界面&quot;">​</a></h4><blockquote><p>注意：在阿里云需要购买3个月以上的服务器才可以申请备案（ECS云服务器中按量付费购买的服务器也不可以申请备案），需要备案的小白要注意了。</p></blockquote><p>当然，如果你还是学生的话，阿里云有“云翼扶持计划”。</p><img src="https://edu-8673.oss-cn-beijing.aliyuncs.com/img2022.12.30/202211141140653.png" alt="image-20221114114044569" style="zoom:67%;"><p>购买成功后，我们需要进行服务器的配置。</p><h3 id="_2-配置自己的服务器" tabindex="-1">2. 配置自己的服务器 <a class="header-anchor" href="#_2-配置自己的服务器" aria-label="Permalink to &quot;2. 配置自己的服务器&quot;">​</a></h3><p>当你购买了服务器后，就可以到右上角的控制台去查看。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnAVibSXgywsGU9qbc3o7RVU6XqMXw1C7fN1CnicGGuBP4w1uCaDlDan7A/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>这里是你自己的控制台，你所购买的产品都可以在这里查看。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgn6Mj9mlWibOl7icdgf4zGIDcLibkneUbXNU2AqQiaeffcG8nTZ7KcK3cFdA/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>点击“远程连接”后</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnmGxvhC7XqxJfUJRM4kuXOzppe4yCw2icwPjAib3N587sMFCFRwzXiciaNQ/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>因为进入控制台后，大部分的操作都需要“管理员权限”，所以首先先切换成“管理员”。输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">sudo su root</span></span></code></pre></div><p>这里的“root”是默认管理员的名字，需要看自己管理员的名字进行更改。</p><p>接下来进入到usr文件夹下，输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">cd /usr</span></span></code></pre></div><blockquote><p>注意，这里cd /usr中间是有一个空格的，否则无法进入。</p></blockquote><p>在usr文件夹下创建一个文件夹，例如：java，用来存放后面用到的tomcat和java的jdk包。输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">mkdir java</span></span></code></pre></div><p>再输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">ls</span></span></code></pre></div><p>就可以查看到usr下所有的文件夹，以及java文件夹是否创建成功。</p><p>因为涉及到jdk,tomcat的安装和解压，为了方便操作，我们需要下载一个软件——xftp（或者filezilla也行），顺便下载java的jdk压缩包，和tomcat的压缩包，具体的可以去官网下载，不细说。</p><p>安装成功后打开xftp，新建会话。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnQD1eu3y8zW3jtwxYypl5O8ibpE3d5xW9jfLp7Hak3XdicXzRcuibauicWQ/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnUSH4vlsIlhT7rZvnINQE8ibOIwQ7CvnuEfkzJicSzmCyZEzLpqIrvFnw/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnRnwG4C0k2ptB3YDvegImx2wYicrodLKgbS4bkkicDoYncc1k8ZhWiaYLw/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>确认之后即可。</p><p>将下载好的JDK和tomcat的压缩包复制粘贴到xftp中右侧的<code>usr/java</code>目录下。（这里我已经粘贴解压好，本来是空的）。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgn8ZaHsUX0g3OJCicaa1M9pohvibeX99INlIBgV3eteXRUjFej8FhGPUicA/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>然后回到命令行控制台，查看一下文件夹是否成功粘贴到java文件夹下。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnWrqPpqpJ8JJjw46spibouxQBDITpAnEkDF1HAyGJxNtxq7TxLBWUrFQ/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>成功后可以解压这两个压缩包在此目录下，分别输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">tar -xzvf  jdk-xxxxx.tar.gz</span></span>
<span class="line"><span style="color:#A6ACCD;"></span></span>
<span class="line"><span style="color:#A6ACCD;">tar -xzvf apache-tomcat-xxxxxx.tar.gz</span></span></code></pre></div><p>xxxx是你自己下载的压缩包对应名字。</p><p>如果觉得解压后的文件夹名字太长，需要更改，输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">mv 更改前名字 更改后名字</span></span></code></pre></div><p>成功后如下图</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnkbSvzVbFW6AaBYPUweV12obia57d4pI0Hic1TneHKTFctib3zWHm1cUHg/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>然后开始配置一些必需变量，输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">vim /etc/profile</span></span></code></pre></div><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnEoVpEwTqPXTTAu33icbGE2UhoV4M0jadzrAer0SbScD0sOYHVDknB6A/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>这里需要在里面添加环境变量，直接在控制台输入。当然，为了方便，可以从xftp中找到profile文件导出，修改后再导入覆盖。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnplQSwqEXdbaDjibocsIyKqt1HGiaicDBVhIic0ZMskRJ4Gj29AbkhjJFvQ/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>右键导出，在结尾增加如下代码：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">JAVA_HOME=/usr/java/你的jdk文件夹名</span></span>
<span class="line"><span style="color:#A6ACCD;">PATH=/usr/java/你的jdk文件夹名/bin:$PATH</span></span>
<span class="line"><span style="color:#A6ACCD;">CLASSPATH=.:/usr/java/你的jdk文件夹名/lib/dt.jar:/usr/java/你的jdk文件夹名/lib/tools.jar</span></span>
<span class="line"><span style="color:#A6ACCD;">CATALINA_HOME=/usr/java/你的tomcat文件夹名</span></span>
<span class="line"><span style="color:#A6ACCD;">export JAVA_HOME PATH CLASSPATH CATALINA_HOME</span></span></code></pre></div><p>修改成功导入即可。</p><p>然后在控制台启动配置，输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">source /etc/profile</span></span></code></pre></div><p>然后再输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">javac</span></span></code></pre></div><p>如果显示下图，去启动tomcat。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnGSrJzxpAjdcLVD0ce2UkvdBI5x1aDHH3XEOX5VVC7GLhVGZvL6KO6w/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>输入：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">cd /usr/java/你的tomcat文件夹名/bin</span></span></code></pre></div><p>启动tomcat：</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">./startup.sh</span></span></code></pre></div><p>如果也出现如下图，恭喜你，你的服务器已经配置成功！！</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnxcOudXZibMYNfzLLnfaD6pib0aFW82Bd5PDPBC9fhn8TDCtexuia6W9ZA/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><h2 id="域名" tabindex="-1">域名 <a class="header-anchor" href="#域名" aria-label="Permalink to &quot;域名&quot;">​</a></h2><p>域名，是由一串用点分隔的名字组成的Internet上某一台计算机或计算机组的名称，用于在数据传输时标识计算机的电子方位。</p><p>IP地址，是Internet主机的作为路由寻址用的数字型标识，人不容易记忆，因而产生了域名这一种字符型标识。</p><p>通俗的说域名就相当于一个家庭的门牌号码，别人通过这个号码可以很容易的找到你。这也意味着在全世界没有重复的域名。当然，此时没有域名也可以使用IP地址来访问你的网站。</p><h3 id="_1-购买属于自己的域名" tabindex="-1">1 购买属于自己的域名 <a class="header-anchor" href="#_1-购买属于自己的域名" aria-label="Permalink to &quot;1 购买属于自己的域名&quot;">​</a></h3><p>可以到阿里云官网进行域名购买，购买前需要先查询你想购买的域名名字是否已经被人注册。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnB6djM4sJ44l7rctJvfDUEw0yr17f9kwDSRKLBJaVjEWgY7kEz5D6bg/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnfaURUt3FbB1Hte8ibiagTqHLo1tGicaQplOJqpxqrr6WFGON2bfDXAJtA/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>选择自己心仪的域名进行注册购买。</p><h3 id="_2-域名的配置" tabindex="-1">2.域名的配置 <a class="header-anchor" href="#_2-域名的配置" aria-label="Permalink to &quot;2.域名的配置&quot;">​</a></h3><p>域名购买成功后，可以进入到自己的控制台查看。</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnnBaCicd462ohZU3lqv1AakNeoIzCVaSkuAKAZEDddVoicegKkS4zog1Q/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>由于刚购买的域名，所以需要实名认证，点击（2）后填写相关资料后提交，大概1个工作日内会有你的“专属商务经理”给你打电话进行实名认证资料和核实，没问题的话一般3-5个工作日内就会认证成功。</p><p>成功之后如下：</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnBuuO0gIy6RepsqibGUcNWPN7ZgAJvGnib24L6brxOEltCcTjfZGiaMf9Q/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>然后就要进行域名的备案了。</p><p>这里需要注意一下：如果你购买的服务器在中国大陆内，就需要进行域名备案才能将域名配置到服务器，如果不是，就可以忽略“备案”这一步。</p><p>具体备案步骤可以点击这里查看（<code>https://help.aliyun.com/knowledge_detail/36922.html?spm=a2c4g.11186623.6.558.30ba1ff5Iku2Fj</code> ），比较详细，我就不细说了。</p><p>备案需要10~20个工作日，在这期间我们可以先进行域名的解析。</p><p>在控制台点击“解析”</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnUWWqM1VDBOrRFvxAhom2NOAfkjhiaJrLiaEUrtaw2ib8TdFHyv8GHVdKQ/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>这里有两种快速域名解析的方法：</p><p>网站域名解析：</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnC42FHzBCbib38XQTMsK2h1DKlRdZKGkaXias42cyoCPHuI9wHZMAauvw/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>邮箱域名解析：</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_png/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnfj3j60Ok382YdqzibVFVCKdD82wtoMMajZvWLaeKbsuvn8EPPicX3gWQ/640?wx_fmt=png&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>点击“确认”，解析成功。</p><h2 id="上传网站源码" tabindex="-1">上传网站源码 <a class="header-anchor" href="#上传网站源码" aria-label="Permalink to &quot;上传网站源码&quot;">​</a></h2><p>我们可以通过FTP类的工具帮助我们更加方便地上传源码到服务器上，目前国外用的较多的是FileZilla，国内用的多的是XFTP工具，putty等。这里我以xftp5为例。</p><p>先前我们已经远程连接过自己的服务器了，这里直接连接即可。</p><p>连接成功之后我们会找到这样一个文件夹（这里的java文件夹是解压jdk和tomcat所在的文件夹）：</p><p><img src="https://mmbiz.qpic.cn/sz_mmbiz_jpg/knmrNHnmCLF3ql4fDc3AXTJzicybVnWgnAEnvsKBhaoibX2xWxSJX1runU0OIQ8t8SibjpPsXXxzWf48sqHDsP1YA/640?wx_fmt=jpeg&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" alt="图片"></p><p>进入到上面绿色框中的文件夹内，其余的东西不需要动，将你做好的整个网站源码放到新的文件夹里（注意最好全英命名），通过FTP传输进来。</p><p>然后你可以通过你的域名+文件夹名+html单页面名即可访问你的网页（例如：<code>www.域名.com/webapps</code>里你存放网页的文件夹名/index）。</p><p>这时候你的网站基本部署完毕了！</p><p>注意：如果你的网页不加端口号就通过IP地址和域名来访问网页，这时候需要尝试修改一下端口，修改到80端口，然后重启一下tomcat 再试一下。tomcat 默认配置文件为 server.xml ，将其中的8080修改为80，然后重启tomcat 再试一下，因为默认只有80端口可以不加端口号进行访问。</p></div></div></main><footer class="VPDocFooter" data-v-6b87e69f data-v-37656e44><!--[--><!--]--><!----><nav class="prev-next" data-v-37656e44><div class="pager" data-v-37656e44><a class="pager-link prev" href="/notebook/Linux/%E5%AE%9E%E7%94%A8%E8%84%9A%E6%9C%AC.html" data-v-37656e44><span class="desc" data-v-37656e44>Previous page</span><span class="title" data-v-37656e44>实用脚本</span></a></div><div class="pager" data-v-37656e44><a class="pager-link next" href="/notebook/Nginx/%E5%9F%BA%E7%A1%80%E7%AF%87.html" data-v-37656e44><span class="desc" data-v-37656e44>Next page</span><span class="title" data-v-37656e44>基础篇</span></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>
    <script>window.__VP_HASH_MAP__=JSON.parse("{\"2、数据库_mysql_mysql面试_基础.md\":\"40da680a\",\"1、学前端_5、小程序_小程序项目.md\":\"60a1629b\",\"1、学前端_4、node_知识篇.md\":\"a7fb500e\",\"1、学前端_2、js_ts_es6 进阶.md\":\"6d07ba10\",\"1、学前端_3、vue_vue3_vue3进阶.md\":\"7ac622b4\",\"5、运维_jenkins.md\":\"929081f8\",\"1、学前端_2、js_ts_typescript.md\":\"875a4aa4\",\"2、数据库_mysql_mysql核心_设计.md\":\"7faf46d1\",\"2、数据库_mysql_mysql核心_基础.md\":\"d8e97f3e\",\"1、学前端_1、html_css_html基础.md\":\"7584d076\",\"1、学前端_5、专题篇_问题篇.md\":\"e893aaa2\",\"2、数据库_mysql_mysql面试_进阶.md\":\"f934806d\",\"3、springboot_运维_原理.md\":\"f4a39db6\",\"2、数据库_influxdb.md\":\"6e1711e1\",\"3、springboot_新特性.md\":\"cdf3e307\",\"mybatis_mybatisplus_jpa.md\":\"8e41681b\",\"1、学前端_5、小程序_小程序优化.md\":\"a2185198\",\"2、数据库_redis_redis基础.md\":\"856df0e0\",\"linux_实用脚本.md\":\"f2299dd5\",\"4、微服务_必备_分布式基础.md\":\"d49863d5\",\"2、数据库_redis_redis优化.md\":\"e66ae32f\",\"4、微服务_springsecurity_进阶篇.md\":\"235a8e9e\",\"5、运维_chatgpt.md\":\"10db3823\",\"2、数据库_mysql_分库分表.md\":\"e1c8a095\",\"start.md\":\"9bc1ff8d\",\"5、运维_github.md\":\"2ec6c735\",\"java学前端_css.md\":\"f11b47f0\",\"1、学前端_5、专题篇_知识篇.md\":\"a463ed8d\",\"linux_软件部署.md\":\"d6722925\",\"2、数据库_neo4j.md\":\"97ad22ac\",\"team.md\":\"ce467a6a\",\"nginx_实战篇.md\":\"7785486e\",\"index.md\":\"8c3ec167\",\"计算机基础_计算机网络_网络基础.md\":\"7a54a85d\",\"1、学前端_4、node_进阶篇.md\":\"60f6db69\",\"java_java集合.md\":\"a049b313\",\"1、学前端_3、vue_vue3_vue3高级.md\":\"614d1516\",\"1、学前端_5、小程序_微信小程序.md\":\"9a4be771\",\"5、运维_netty.md\":\"12ca0278\",\"2、数据库_mysql_mysql核心_运维.md\":\"83f97c16\",\"idea_vs code.md\":\"afdcb593\",\"java学前端_vue3_组件.md\":\"1086884e\",\"idea_chrome.md\":\"4a32afbc\",\"云原生_k8s.md\":\"db58e65a\",\"2、数据库_mysql_mysql核心_进阶.md\":\"61d16dff\",\"ssm_springbatch.md\":\"f799ab4a\",\"三高_分布式.md\":\"db1b8a1b\",\"2、数据库_elasticsearch_1、es基础.md\":\"04d17448\",\"linux_linux基础.md\":\"4b0bf394\",\"idea_idea插件.md\":\"fa86e45a\",\"可视化 _ 监控_可视化大屏.md\":\"004553bd\",\"2、数据库_mongodb_整合.md\":\"3c47d7f4\",\"4、微服务_springsecurity_基础篇.md\":\"534a3401\",\"4、微服务_进阶.md\":\"69095c58\",\"计算机基础_计算机基础_操作系统.md\":\"0f75d113\",\"可视化 _ 监控_zabbix.md\":\"71f2270e\",\"nginx_基础篇.md\":\"c7d8bb50\",\"1、学前端_4、node_项目实战.md\":\"bc5065b8\",\"2、数据库_redis_redis原理.md\":\"5cedf685\",\"可视化 _ 监控_监控基础.md\":\"ac56ce4d\",\"三高_高并发.md\":\"ea9ffc99\",\"2、数据库_redis_redis高级.md\":\"1d5872f6\",\"1、学前端_4、node_基础篇.md\":\"581cc13a\",\"2、数据库_mongodb_基础.md\":\"fb7a0a29\",\"idea_idea基础.md\":\"6f2f9638\",\"4、微服务_必备_sentinel.md\":\"2edfbf6c\",\"2、数据库_elasticsearch_3、es高级.md\":\"ef146606\",\"1、学前端_3、vue_vue3_vue3新语法.md\":\"8afd5409\",\"消息中间件_canal.md\":\"3949163c\",\"ssm_maven.md\":\"2c5e12ed\",\"4、微服务_springsecurity_高级篇.md\":\"882d3ff3\",\"linux_linux进阶.md\":\"188ef7b4\",\"计算机基础_设计模式_uml.md\":\"634ba256\",\"计算机基础_算法_leetcode.md\":\"77162fb9\",\"项目实战_小兔鲜_进阶篇1.md\":\"17c52c81\",\"1、学前端_2、js_ts_es6 基础.md\":\"fda3f18b\",\"项目实战_小兔鲜_进阶篇2.md\":\"a0f23006\",\"软件测试_测试基础.md\":\"8c1060cd\",\"2、数据库_redis_本地缓存.md\":\"00617fe6\",\"nginx_面试篇.md\":\"e3fb373a\",\"mybatis_mybatisplus_mybatis.md\":\"9239e0ad\",\"linux_shell.md\":\"ae53d83b\",\"2、数据库_mysql_mysql核心_优化.md\":\"36230425\",\"项目实战_项目推荐.md\":\"f9d97630\",\"mybatis_mybatisplus_mybatisplus.md\":\"0030fd35\",\"项目实战_百度地图_进阶篇.md\":\"c8b93267\",\"三高_高可用.md\":\"323840c5\",\"java_java新特性.md\":\"22abf56d\",\"软件测试_压力测试.md\":\"9ab44440\",\"java学前端_html_js.md\":\"e0fcd240\",\"2、数据库_redis_redis实战.md\":\"d6daeeab\",\"nginx_进阶篇.md\":\"e6b63195\",\"三高_秒杀.md\":\"3878bb64\",\"5、运维_git.md\":\"0264925c\",\"java_java进阶.md\":\"e79cb5b4\",\"并发 _ 多线程_基础篇.md\":\"7adbfac5\",\"项目实战_百度地图_基础篇.md\":\"8afa5954\",\"java学前端_react.md\":\"3ec827dd\",\"1、学前端_1、html_css_css基础.md\":\"01b56712\",\"项目实战_小兔鲜_基础篇.md\":\"646f5df5\",\"1、学前端_2、js_ts_js 基础.md\":\"cb13e36f\",\"可视化 _ 监控_监控进阶.md\":\"0cdbc292\",\"计算机基础_设计模式_基础篇.md\":\"51617287\",\"计算机基础_数据结构_基础篇.md\":\"b2bfd8d4\",\"项目实战_苍穹外卖_进阶篇.md\":\"48415e41\",\"ssm_spring.md\":\"ab514659\",\"消息中间件_rabbitmq.md\":\"45b1eb28\",\"1、学前端_1、html_css_网页进阶.md\":\"db998248\",\"消息中间件_kafka.md\":\"b747dabf\",\"云原生_docker.md\":\"983c7ba7\",\"4、微服务_必备_分布式锁.md\":\"5af1cf8d\",\"消息中间件_rocketmq.md\":\"d441da85\",\"项目实战_黑马头条_基础篇.md\":\"b05af3a6\",\"ssm_springmvc.md\":\"81b9714f\",\"项目实战_支付.md\":\"1d7407dd\",\"项目实战_黑马头条_进阶篇2.md\":\"bff0015b\",\"项目实战_黑马头条_进阶篇.md\":\"19f18388\",\"java学前端_vue2_组件.md\":\"58c6b1df\",\"3、springboot_基础篇.md\":\"529c66f4\",\"3、springboot_应用篇.md\":\"8b92aa61\",\"项目实战_黑马头条_高级篇.md\":\"227c08c1\",\"1、学前端_5、小程序_uniapp.md\":\"71a282b4\",\"项目实战_云尚办公_基础篇.md\":\"1fe188ba\",\"并发 _ 多线程_并发完善.md\":\"26619c46\",\"1、学前端_2、js_ts_js 进阶.md\":\"657dfb8f\",\"java_java高级.md\":\"23782d1a\",\"java_java基础.md\":\"86d67c77\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"VitePress\",\"description\":\"A VitePress site\",\"base\":\"/notebook/\",\"head\":[],\"appearance\":true,\"themeConfig\":{\"algolia\":{\"appId\":\"DW7O63I9IR\",\"apiKey\":\"f8ed758cdb288a8b06542bc35923c1a1\",\"indexName\":\"notebook\"},\"sidebar\":[{\"text\":\"Java\",\"collapsed\":true,\"items\":[{\"text\":\"Java基础\",\"link\":\"/Java/Java基础\"},{\"text\":\"Java新特性\",\"link\":\"/Java/Java新特性\"},{\"text\":\"Java进阶\",\"link\":\"/Java/Java进阶\"},{\"text\":\"Java集合\",\"link\":\"/Java/Java集合\"},{\"text\":\"Java高级\",\"link\":\"/Java/Java高级\"}]},{\"text\":\"Linux\",\"collapsed\":true,\"items\":[{\"text\":\"Linux基础\",\"link\":\"/Linux/Linux基础\"},{\"text\":\"Linux新特性\",\"link\":\"/Linux/Linux进阶\"},{\"text\":\"Shell脚本\",\"link\":\"/Linux/Shell\"},{\"text\":\"实用脚本\",\"link\":\"/Linux/实用脚本\"},{\"text\":\"软件部署\",\"link\":\"/Linux/软件部署\"}]},{\"text\":\"Nginx\",\"collapsed\":true,\"items\":[{\"text\":\"基础篇\",\"link\":\"/Nginx/基础篇\"},{\"text\":\"进阶篇\",\"link\":\"/Nginx/进阶篇\"},{\"text\":\"实战篇\",\"link\":\"/Nginx/实战篇\"},{\"text\":\"面试篇\",\"link\":\"/Nginx/面试篇\"}]},{\"text\":\"SSM\",\"collapsed\":true,\"items\":[{\"text\":\"Maven\",\"link\":\"/SSM/Maven\"},{\"text\":\"Spring\",\"link\":\"/SSM/Spring\"},{\"text\":\"SpringMVC\",\"link\":\"/SSM/SpringMVC\"},{\"text\":\"SpringBatch\",\"link\":\"/SSM/SpringBatch\"}]},{\"text\":\"SpringBoot\",\"collapsed\":true,\"items\":[{\"text\":\"基础篇\",\"link\":\"/3、SpringBoot/基础篇\"},{\"text\":\"应用篇\",\"link\":\"/3、SpringBoot/应用篇\"},{\"text\":\"新特性\",\"link\":\"/3、SpringBoot/新特性\"},{\"text\":\"运维&原理\",\"link\":\"/3、SpringBoot/运维&原理\"}]},{\"text\":\"SpringCloud\",\"collapsed\":true,\"items\":[{\"text\":\"SpringCloud\",\"link\":\"/4、微服务/进阶\"},{\"text\":\"Sentinel\",\"link\":\"/4、微服务/必备/Sentinel\"}]},{\"text\":\"SpringSecurity\",\"collapsed\":true,\"items\":[{\"text\":\"SpringSecurity基础篇\",\"link\":\"/4、微服务/SpringSecurity/基础篇\"},{\"text\":\"SpringSecurity进阶篇\",\"link\":\"/4、微服务/SpringSecurity/进阶篇\"},{\"text\":\"SpringSecurity高级篇\",\"link\":\"/4、微服务/SpringSecurity/高级篇\"}]},{\"text\":\"Mybatis & MybatisPlus\",\"collapsed\":true,\"items\":[{\"text\":\"Mybatis\",\"link\":\"/Mybatis&MybatisPlus/Mybatis\"},{\"text\":\"MybatisPlus\",\"link\":\"/Mybatis&MybatisPlus/MybatisPlus\"},{\"text\":\"JPA\",\"link\":\"/Mybatis&MybatisPlus/JPA\"}]},{\"text\":\"Git & ChatGPT\",\"collapsed\":true,\"items\":[{\"text\":\"Git\",\"link\":\"/5、运维/Git\"},{\"text\":\"Github\",\"link\":\"/5、运维/Github\"},{\"text\":\"ChatGPT\",\"link\":\"/5、运维/ChatGPT\"},{\"text\":\"Jenkins\",\"link\":\"/5、运维/Jenkins\"},{\"text\":\"Netty\",\"link\":\"/5、运维/Netty\"}]},{\"text\":\"数据库\",\"collapsed\":true,\"items\":[{\"text\":\"MySQL\",\"collapsed\":true,\"items\":[{\"text\":\"MySQL基础\",\"link\":\"/2、数据库/MySQL/MySQL核心/基础\"},{\"text\":\"MySQL进阶\",\"link\":\"/2、数据库/MySQL/MySQL核心/进阶\"},{\"text\":\"MySQL优化\",\"link\":\"/2、数据库/MySQL/MySQL核心/优化\"},{\"text\":\"MySQL设计\",\"link\":\"/2、数据库/MySQL/MySQL核心/设计\"},{\"text\":\"MySQL运维\",\"link\":\"/2、数据库/MySQL/MySQL核心/运维\"},{\"text\":\"分库分表\",\"link\":\"/2、数据库/MySQL/分库分表\"}]},{\"text\":\"Redis\",\"collapsed\":true,\"items\":[{\"text\":\"Redis基础\",\"link\":\"/2、数据库/Redis/Redis基础\"},{\"text\":\"Redis优化\",\"link\":\"/2、数据库/Redis/Redis优化\"},{\"text\":\"Redis原理\",\"link\":\"/2、数据库/Redis/Redis原理\"},{\"text\":\"Redis高级\",\"link\":\"/2、数据库/Redis/Redis高级\"},{\"text\":\"Redis实战\",\"link\":\"/2、数据库/Redis/Redis实战\"},{\"text\":\"本地缓存\",\"link\":\"/2、数据库/Redis/本地缓存\"}]},{\"text\":\"MongoDB\",\"collapsed\":true,\"items\":[{\"text\":\"MongoDB基础\",\"link\":\"/2、数据库/MongoDB/基础\"},{\"text\":\"MongoDB进阶\",\"link\":\"/2、数据库/MongoDB/整合\"}]},{\"text\":\"ElasticSearch\",\"collapsed\":true,\"items\":[{\"text\":\"ES基础\",\"link\":\"/2、数据库/ElasticSearch/1、ES基础\"},{\"text\":\"ES高级\",\"link\":\"/2、数据库/ElasticSearch/3、ES高级\"}]},{\"text\":\"InfluxDB\",\"link\":\"/2、数据库/influxdb\"},{\"text\":\"Neo4j\",\"link\":\"/2、数据库/Neo4j\"}]},{\"text\":\"高并发 & 秒杀 & 分布式\",\"collapsed\":true,\"items\":[{\"text\":\"分布式理论\",\"link\":\"/三高/分布式\"},{\"text\":\"分布式锁\",\"link\":\"/4、微服务/必备/分布式锁\"},{\"text\":\"秒杀\",\"link\":\"/三高/秒杀\"},{\"text\":\"高可用\",\"link\":\"/三高/高可用\"},{\"text\":\"高并发\",\"link\":\"/三高/高并发\"}]},{\"text\":\"云原生\",\"collapsed\":true,\"items\":[{\"text\":\"Docker\",\"link\":\"/云原生/Docker\"},{\"text\":\"K8S\",\"link\":\"/云原生/K8S\"}]},{\"text\":\"可视化 & 监控\",\"collapsed\":true,\"items\":[{\"text\":\"监控基础\",\"link\":\"/可视化 & 监控/监控基础\"},{\"text\":\"监控进阶\",\"link\":\"/可视化 & 监控/监控进阶\"},{\"text\":\"可视化大屏\",\"link\":\"/可视化 & 监控/可视化大屏\"},{\"text\":\"Zabbix\",\"link\":\"/可视化 & 监控/Zabbix\"}]},{\"text\":\"学前端\",\"collapsed\":true,\"items\":[{\"text\":\"HTML+CSS\",\"collapsed\":true,\"items\":[{\"text\":\"HTML基础\",\"link\":\"/1、学前端/1、HTML+CSS/HTML基础\"},{\"text\":\"CSS基础\",\"link\":\"/1、学前端/1、HTML+CSS/CSS基础\"},{\"text\":\"网页进阶\",\"link\":\"/1、学前端/1、HTML+CSS/网页进阶\"}]},{\"text\":\"JS+TS\",\"collapsed\":true,\"items\":[{\"text\":\"JS基础\",\"link\":\"/1、学前端/2、JS+TS/JS 基础\"},{\"text\":\"JS进阶\",\"link\":\"/1、学前端/2、JS+TS/JS 进阶\"},{\"text\":\"ES6基础\",\"link\":\"/1、学前端/2、JS+TS/ES6 基础\"},{\"text\":\"ES6进阶\",\"link\":\"/1、学前端/2、JS+TS/ES6 进阶\"},{\"text\":\"TS基础\",\"link\":\"/1、学前端/2、JS+TS/TypeScript\"}]},{\"text\":\"NodeJS\",\"collapsed\":true,\"items\":[{\"text\":\"Node基础\",\"link\":\"/1、学前端/4、Node/基础篇\"},{\"text\":\"Node进阶\",\"link\":\"/1、学前端/4、Node/进阶篇\"},{\"text\":\"项目实战\",\"link\":\"/1、学前端/4、Node/项目实战\"}]},{\"text\":\"Vue\",\"collapsed\":true,\"items\":[{\"text\":\"Vue3进阶\",\"link\":\"/1、学前端/3、Vue/Vue3/Vue3进阶\"},{\"text\":\"Vue3高级\",\"link\":\"/1、学前端/3、Vue/Vue3/Vue3高级\"},{\"text\":\"Vue3新语法\",\"link\":\"/1、学前端/3、Vue/Vue3/Vue3新语法\"},{\"text\":\"项目实战\",\"link\":\"/1、学前端/3、Vue/Vue2/Vue2项目\"}]},{\"text\":\"小程序\",\"collapsed\":true,\"items\":[{\"text\":\"小程序基础\",\"link\":\"/1、学前端/5、小程序/微信小程序\"},{\"text\":\"小程序优化\",\"link\":\"/1、学前端/5、小程序/小程序优化\"},{\"text\":\"uniapp\",\"link\":\"/1、学前端/5、小程序/uniapp\"},{\"text\":\"项目实战\",\"link\":\"/1、学前端/5、小程序/小程序项目\"}]}]},{\"text\":\"计算机基础\",\"collapsed\":true,\"items\":[{\"text\":\"数据结构\",\"link\":\"/计算机基础/数据结构/基础篇\"},{\"text\":\"操作系统\",\"link\":\"/计算机基础/计算机基础/操作系统\"},{\"text\":\"设计模式\",\"link\":\"/计算机基础/设计模式/基础篇\"},{\"text\":\"计算机网络\",\"link\":\"/计算机基础/计算机网络/网络基础\"},{\"text\":\"UML\",\"link\":\"/计算机基础/设计模式/UML\"},{\"text\":\"LeetCode\",\"link\":\"/计算机基础/算法/LeetCode\"}]},{\"text\":\"项目实战\",\"collapsed\":true,\"items\":[{\"text\":\"云尚办公\",\"collapsed\":true,\"items\":[{\"text\":\"基础篇\",\"link\":\"/项目实战/云尚办公/基础篇\"}]},{\"text\":\"小兔鲜\",\"collapsed\":true,\"items\":[{\"text\":\"基础篇\",\"link\":\"/项目实战/小兔鲜/基础篇\"},{\"text\":\"进阶篇1\",\"link\":\"/项目实战/小兔鲜/进阶篇1\"},{\"text\":\"进阶篇2\",\"link\":\"/项目实战/小兔鲜/进阶篇2\"}]},{\"text\":\"地图\",\"collapsed\":true,\"items\":[{\"text\":\"基础篇\",\"link\":\"/项目实战/百度地图/基础篇\"},{\"text\":\"进阶篇\",\"link\":\"/项目实战/百度地图/进阶篇\"}]},{\"text\":\"苍穹外卖\",\"collapsed\":true,\"items\":[{\"text\":\"进阶篇\",\"link\":\"/项目实战/苍穹外卖/进阶篇\"}]},{\"text\":\"黑马头条\",\"collapsed\":true,\"items\":[{\"text\":\"基础篇\",\"link\":\"/项目实战/黑马头条/基础篇\"},{\"text\":\"进阶篇\",\"link\":\"/项目实战/黑马头条/进阶篇\"},{\"text\":\"进阶篇2\",\"link\":\"/项目实战/黑马头条/进阶篇2\"},{\"text\":\"高级篇\",\"link\":\"/项目实战/黑马头条/高级篇\"}]},{\"text\":\"支付\",\"link\":\"/项目实战/支付\"},{\"text\":\"项目推荐\",\"link\":\"/项目实战/项目推荐\"}]},{\"text\":\"团队成员\",\"link\":\"/team\"}],\"siteTitle\":\"任硕的文档\",\"logo\":\"/Vue.png\",\"nav\":[{\"text\":\"Java学前端\",\"items\":[{\"items\":[{\"text\":\"HTML+JS\",\"link\":\"/Java学前端/HTML+JS\"},{\"text\":\"CSS\",\"link\":\"/Java学前端/CSS\"},{\"text\":\"Vue2+组件\",\"link\":\"/Java学前端/Vue2+组件\"},{\"text\":\"Vue3+组件\",\"link\":\"/Java学前端/Vue3+组件\"},{\"text\":\"React\",\"link\":\"/Java学前端/React\"}]}],\"activeMatch\":\"/Java/\"},{\"text\":\"软件测试\",\"items\":[{\"items\":[{\"text\":\"测试基础\",\"link\":\"/软件测试/测试基础\"},{\"text\":\"压力测试\",\"link\":\"/软件测试/压力测试\"}]}]},{\"text\":\"多线程\",\"items\":[{\"items\":[{\"text\":\"基础篇\",\"link\":\"/并发 & 多线程/基础篇\"},{\"text\":\"进阶篇\",\"link\":\"/并发 & 多线程/并发完善\"}]}]},{\"text\":\"开发工具\",\"items\":[{\"items\":[{\"text\":\"Chrome\",\"link\":\"/IDEA/Chrome\"},{\"text\":\"IDEA基础\",\"link\":\"/IDEA/IDEA基础\"},{\"text\":\"IDEA插件\",\"link\":\"/IDEA/IDEA插件\"},{\"text\":\"VS Code\",\"link\":\"/IDEA/VS Code\"}]}]},{\"text\":\"消息中间件\",\"items\":[{\"items\":[{\"text\":\"RabbitMQ\",\"link\":\"/消息中间件/RabbitMQ\"},{\"text\":\"RocketMQ\",\"link\":\"/消息中间件/RocketMQ\"},{\"text\":\"Kafka\",\"link\":\"/消息中间件/Kafka\"},{\"text\":\"Canal\",\"link\":\"/消息中间件/Canal\"}]}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/renshuo123/renshuo123.github.io\"},{\"icon\":\"twitter\",\"link\":\"#\"},{\"icon\":{\"svg\":\"<svg t=\\\"1676028692954\\\" class=\\\"icon\\\" ...</path></svg>\"},\"link\":\"https://github.com/\"}]},\"locales\":{},\"scrollOffset\":90,\"cleanUrls\":false}");</script>
    
  </body>
</html>